Ant Property Task - Apache Ant

What is Ant Property Task?

Ant build files are written in XML, which does not permit declaring variables as you do on your preferred programming language. but, as you can have imagined, it would be useful if Ant allowed declaring variables such as project name, project supply listing, etc.

Ant uses the Property detail which permits you to specify properties. This allows the properties to be changed from one build to another or from one environment to another.

Through default, Ant presents the following pre-described properties that may be used within the build file:

Properties

Description

ant.file

The full location of the build file.

ant.version

The version of the Apache Ant installation.

basedir

The basedir of the build, as specified in thebasedirattribute of theprojectelement.

ant.java.version

The version of the JDK that is used by Ant.

ant.project.name

The name of the project, as specified in thenameatrribute of theprojectelement.

ant.project.default-target

The default target of the current project.

ant.project.invoked-targets

Comma separated list of the targets that were invoked in the current project.

ant.core.lib

The full location of the Ant jar file.

ant.home

The home directory of Ant installation.

ant.library.dir

The home directory for Ant library files - typically ANT_HOME/lib folder.

Ant also makes the system properties (example: report.separator) available to the build file.

Similarly to the above, the user can define additional properties the use of the Property detail. the following example indicates the way to outline a property called sitename:

Running Ant on the above build file produces the following output:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Ant Topics