« Return to Thread: Replacing build.xml with Build.java - Doing Ant builds directly from Java

Replacing build.xml with Build.java - Doing Ant builds directly from Java

by Dean Schulze :: Rate this Message:

Reply to Author | View in Thread


The Ant documentation has a section titled "Using Ant Tasks Outside
of Ant" which gives a teaser for how to use the Ant libraries from Java
code.  In theory it seems simple enough to replace build.xml with
Build.java. The Ant documentation hints at some undocumented
dependencies that I'll have to discover (undocumented from the point of
view of using Ant from within Java).
Using Java instead of xml to do an Ant build seems so obvious I wonder why there hasn't been a parallel track over the years for Build.java as well as build.xml.
I asked this same question over at stackoverflow.com:
http://stackoverflow.com/questions/972574/replacing-build-xml-with-build-java-using-java-and-the-ant-libraries-as-a-build
The answers indicate that it isn't difficult to do, but that it is necessary to "spoof" the project and target objects.
While it all looks encouraging I haven't seen any actual examples of how to deal with the undocumented issues mentioned.  Has anyone documented how to do Ant builds from Java?
Thanks.
Dean




 « Return to Thread: Replacing build.xml with Build.java - Doing Ant builds directly from Java