ANT Tutorial

ANT Properties

Properties are an important way to customize a build process or to just provide shortcuts for strings that are used repeatedly inside a build file. Properties in Ant are like programming language variables in that they have a name and a value. However, unlike normal variables, properties in Ant cannot be changed once they have been set; they are immutable, like String objects in the Java language. A sample Ant property definition looks like this:

<property name="envName" value="integration" />
To refer to this property in other parts of the build file, you would use this syntax:

<property name="successMailSubject" value="${envName} build completed successfully" />
Built-in Properties
Ant provides access to all system properties as if they had been defined using a <property> task. For example, ${os.name} expands to the name of the operating system. For a list of system properties see the Javadoc of System.getProperties.
In addition, Ant has some 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.java.version the JVM version Ant detected