I anticipate using a simple build.xml with different targets to kick off the 
Build.java file passing in whatever parameters correspond to different 
targets.  The heavy lifting would be done by the Build.java.  build.xml would 
be used for parameter passing and for integration with Eclipse.

Ant build scripts make simple things like an if .... else difficult and things 
like changing the value of a property impossible.  Simple things can be done in 
xml I only anticipate using build.xml to invoke the Build.java.



--- On Thu, 6/11/09, Cole, Derek E <derek.e.c...@lmco.com> wrote:

From: Cole, Derek E <derek.e.c...@lmco.com>
Subject: RE: Replacing build.xml with Build.java - Doing Ant builds directly 
from Java
To: "Ant Users List" <user@ant.apache.org>
Date: Thursday, June 11, 2009, 9:41 AM

You are correct that there is very little documentation on the subject, other 
than a few small, simple examples on the net.  It seemed like one of the 
responders in that link you posted was implying that he spoofed the tasks he 
needed to use? That seems like quite a bit more work than would be necessary. 
When I have used ant from java, it was primarily to control dependencies, but I 
still had underlying build.xml files that individual targets were called from, 
using the java program to control when, handle errors, etc.

Derek

-----Original Message-----
From: Dean Schulze [mailto:dean_w_schu...@yahoo.com] 
Sent: Thursday, June 11, 2009 11:28 AM
To: user@ant.apache.org
Subject: Replacing build.xml with Build.java - Doing Ant builds directly from 
Java


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




      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org




      

Reply via email to