tags:

views:

313

answers:

4

How can I get the value of the current target ant?

Does it exist a spacial variable something called TARGET?

+1  A: 

I think you can't, unless you spend some time coding your own custom tasks (http://ant.apache.org/manual/tutorial-writing-tasks.html)

The built-in properties you can display are: basedir, ant.file, ant.version, ant.project.name, ant.java.version

JuanZe
+1  A: 

If you run ant using the -projecthelp arg:

ant -projecthelp

you will get a listing of the main targets specified in the build.xml (or other build file as declared on the commandline).

akf
A: 

IIRC there was a lot of discussion about this a while back (like maybe 18 months) about this. I can't remember what, if anything, was decided about it. The website has links to the mailing list archives.

A: 

Based on the issue you have to patch ant or used javascript:

project.setNewProperty("current_target", self.getOwningTarget()); ${current_target}

FoxyBOA