Hello and happy new year to you all, What is the recommended way for launching an Ant script/task from Java code ?
It seems to me that the following URL http://ant.apache.org/manual/running.html#viajava rather explains how to launch Ant with java.exe from the command line. Is it also recommended to launch the main() method from with a Java code? Or is there a launch API that can be used? I also found people working directly with the Ant project class. Something like: Project p = new Project(); p.initProperties(); p.setBaseDir(getBaseDir(baseDir, buildFile)); p.setUserProperty("ant.file", getBuildFile(buildFile)); try { p.fireBuildStarted(); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference("ant.projectHelper", helper); helper.parse(p, buildFile); p.executeTarget(null == target ? p.getDefaultTarget() : target); p.fireBuildFinished(null); } catch (BuildException e) { p.fireBuildFinished(e); [...] } finally { [...] } Thank you, Patrick --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org