Configuration configuration
= configurationBuilder.build(tasksConfigurationResource.toString());
TaskManager manager = new TaskManager();
manager.configure(configuration);
AntTask task = (AntTask) manager.getTask(taskId);
Parameters parameters = new Parameters();
URL buildfileResource
= getClass().getClassLoader().getResource("org/apache/lenya/cms/task/tasks.xml");
File buildfile = new File(new URI(buildfileResource.toString()));
parameters.setParameter(AntTask.BUILDFILE, buildfile.getAbsolutePath());
task.parameterize(parameters);
String servletContextPath = task.getParameters().getParameter(Task.PARAMETER_SERVLET_CONTEXT);
task.execute(servletContextPath);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}