Javatpoint Logo
Javatpoint Logo

Apache Ant Properties

Properties are key-value pairs where each value is associated to a key. The property is used to set value which can be accessed anywhere in the buildfile. Once a property is set, it cannot be changed.

Apache Ant provides <property> tag which can be used to set property.

Apache Ant Property Types

  1. Built-in Properties
  2. User defined Properties

Apache Ant Built-in Properties

Apache Ant provides various built-in properties and we can access all these properties in our buildfile. Some built-in properties are given below.

Property Description
basedir It is used for the absolute path of the project's basedir.
ant.file It is used for the absolute path of the buildfile.
ant. version It is used for the version of Ant.
ant.project.name It holds name of the project that is currently executing.
ant.project.default-target It holds name of the currently executing project's default target.
ant.project.invoked-targets A list of the targets when invoking the current project.
ant.java.version It holds the JVM version.
ant.core.lib the absolute path of the ant.jar file.
ant.home It contains home directory of Ant.
ant.library.dir It holds the directory that has been used to load Ant's jars from.

Apache Ant User defined Properties

Apart from built-in properties, Apache Ant also provides the facility to create custom properties in buildfile.

To create properties, <property> tag is provided which uses name and value attributes. The name attribute is the name of the property and value attribute holds a value.

To understand further, let's see an example.

Apache Ant Property Example

// build.xml

Output:


Apache Ant Properties





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA