Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the ant build xml file's own name?

Tags:

filenames

ant

let's say I have a file named build_dev_linux.xml.

My question is

How can I find the ant script XML file's own name, build_dev_linux.xml so I can put it on variable or property in that XML file.?

like image 400
x_xo_o0_0 Avatar asked Feb 13 '13 04:02

x_xo_o0_0


1 Answers

Ant defines a useful list of built-in properties:

basedir             the absolute path of the project's basedir (as set
                    with the basedir attribute of <project>).
ant.file            the absolute path of the buildfile.
ant.version         the version of Ant
ant.project.name    the name of the project that is currently executing;
                    it is set in the name attribute of <project>.
ant.project.default-target
                    the name of the currently executing project's
                    default target;  it is set via the default
                    attribute of <project>.
ant.project.invoked-targets
                    a comma separated list of the targets that have
                    been specified on the command line (the IDE,
                    an <ant> task ...) when invoking the current
                    project.
ant.java.version    the JVM version Ant detected; currently it can hold
                    the values "1.2", "1.3",
                    "1.4",  "1.5" and "1.6".
ant.core.lib        the absolute path of the ant.jar file.

The ant.file property is what you need. If you want just the file name without the path then you can use the basename task like

<basename file="${ant.file}" property="buildfile"/>
like image 69
Geoff Reedy Avatar answered Oct 11 '22 13:10

Geoff Reedy