I'm using Ant 1.8.2. From within my build.xml file, how do I find out what targets were used on the command line when invoking Ant?
Thanks, - Dave
To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.
To show every target associated with a build. xml file, you need to run ant -p -v Also, ant -p build.
When a target is invoked by antcall , all of its dependent targets will also be called within the context of any new parameters. For example. if the target doSomethingElse ; depended on the target init , then the antcall of doSomethingElse will call init during the call.
As Ant runs, it displays the name of each target executed. As our example output shows, Ant executes prepare followed by compile . This is because compile is the default target, which has a dependency on the prepare target.
Use the ant.project.invoked-targets
property:
<echo message="Targets: ${ant.project.invoked-targets}"/>
It's new since ant 1.8, I think. Some more Ant built-in properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With