ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <>
Subject RE: re-reading build file from within ant
Date Thu, 19 Jun 2003 17:30:39 GMT
I have written a build.xml that, as the first step, calls version
control (StarTeam in this case but that's not important) and checks out
the latest version of build.xml, then calls into it using the <ant> task
to do the real work.  This works like a charm, and I see no reason why a
similar scheme would not work for your regeneration.  Jeff's solution
might be a little easier and less error prone depending on the level of
regeneration you are doing, but assuming that is all worked out and
solid, you could use the same file, as I do in mine.

-----Original Message-----
From: Faist, Jeff [] 
Sent: Thursday, June 19, 2003 12:15 PM
To: 'Ant Users List'
Subject: RE: re-reading build file from within ant

I use to do this with makefiles am therefore unsure if it will work with

Leave build.xml alone and have it test for a second file that would be
the one that is regenerated and does the real work.  builds.xml will
test for this file being out of date, rebuild it then call it as needed.
that way builds.xml will not change so no errors will occur and the
other file is not loaded ( .include in make ) until after it's rebuilt
so it's content change will not cause an error either.

something to test and consider.

Jeffrey W. Faist 
Configuration Management Analyst 
Encoda Systems, Inc. 
1999 Broadway, Suite 4000 
Denver, Colorado 80202-3050 USA 
Direct Phone Line: +1 (303) 390 8496 
Fax Line: +1 (303) 390 8425 

-----Original Message-----
From: Phillip Lord []
Sent: Thursday, June 19, 2003 11:06 AM
Subject: re-reading build file from within ant

I'm currently using a tool** that generates my build.xml file for me
from a couple of other source files

This works quite nicely but has one problem. I am using ant itself to
check when the source files for the build.xml file get out of date. This
works fine, but rest of the build gets run according to the old
build.xml which has already been loaded and parsed. So you have to run
the build twice (once to regenerate the build.xml, and once to actually
do the build). Which is a pain. 

The best I have come up with is this...

1) run the build. If the build.xml file is updated, run ant again with
   the <ant> task. When this completes, fail in the current build. 

This will result in a failure message, even if the internal build
succeeds, which is messy, and also I don't know how to get the targets
sent to the command line for the original ant, so I can't launch the
internal one properly. 

2) Just fail if the build.xml gets rebuilt. 

This is not a good user experience!

3) Use an external script instead of ant. This will run ant twice,
   once to update build.xml if needed, and secondly to actually run
   the build. 

And this requires people to change their IDE to not launch ant directly,
which is a pain. 

Has anyone got any better ideas?


** The tool is called antmerge, in case anyone is interested..

To unsubscribe, e-mail:
For additional commands, e-mail:

"This information in this e-mail is intended solely for the addressee
and may contain information which is confidential or privileged.  Access
to this e-mail by anyone else is unauthorized.  If you are not the
intended recipient, or believe that you have received this communication
in error, please do not print, copy, retransmit, disseminate, or
otherwise use the information. Also, please notify the sender that you
have received this e-mail in error, and delete the copy you received."

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message