Question : Invoking an ANT target in a build.xml file from another ANT build file.

Hi,

I have 2 ANT build.xml files and I was wondering if there was a way I can invoke an ANT target of one build.xml file in the second build.xml file.

If this is possible, could someone post a snippet?

Thanks!

Answer : Invoking an ANT target in a build.xml file from another ANT build file.

I'm not sure what doesn't work for you, I tried the code you posted (note that you never close the comment       ) and it works fine for me.
I'm attaching here the two files I'm using (change the extension from .txt to .xml)
I'm running it from command-line:
ant -f build_orig.xml addVersion

and the output is:
Buildfile: build_orig.xml

main:
     [echo]
     [echo]                 Buliding the .jar file
     [echo]

addVersion:

BUILD SUCCESSFUL
Total time: 0 seconds


My ant version is 1.7.0, but it should work with older versions as well
C:\Temp\xml>ant -version
Apache Ant version 1.7.0 compiled on December 13 2006


If you still have a problem can you please post exactly what is not working (do you get an error? Does it run but not do what you want?)
 
build.xml
 
 
build_orig.xml
 
Random Solutions  
 
programming4us programming4us