final Project antProject = new Project();
antProject.addBuildListener(new DebugAntBuildListener());
final WsGenTask task = new WsGenTask();
task.setProject(antProject);
if (binding != null) {
task.setBinding(binding);
}
if (profile != null) {
task.setProfile(profile);
}
if (thePackage != null) {
task.setPackage(thePackage);
}
task.setOutputDirectory(outputDirectory.getAbsolutePath());
for (Iterator iterator = wsdls.iterator(); iterator.hasNext();) {
String wsdlUrl = (String) iterator.next();
if (!wsdlUrl.contains("://")) {
wsdlUrl = new File(wsdlUrl).toURI().toString();
}
task.setWsdl(wsdlUrl);
getLog().info("Executing XFire WsGen task with url: " + wsdlUrl);
try {
task.execute();
} catch (BuildException e) {
throw new MojoExecutionException("command execution failed", e);
}
}