Home

 

Ant build files

Ant uses XML build files to define what operations must be performed to build a project. Here is a list of the main components of a build file:

Project: A build file contains build information for a single project. It can contain one or more targets.

Target: A target describes the tasks that must be performed to satisfy a goal. For example, compiling source code into class files might be one target, and packaging the class files into a JAR file might be another target.

Targets can depend upon other targets. For example, the class files must be up-to-date before you can create the JAR file. Ant can resolve these dependencies.

Task: A task is a single step that must be performed to satisfy a target.
Tasks are implemented as Java classes that are invoked by Ant, passing parameters defined as attributes in the XML. Ant provides a set of standard tasks (core tasks), a set of optional tasks, and an API, which allows you to write your own tasks.

Property: A property has a name and a value pair. Properties are essentially variables that can be passed to tasks through task attributes. Property values can be set inside a build file, or obtained externally from a properties file or from the command line. A property is referenced by enclosing the property name inside ${}, for example ${basedir}.

Path: A path is a set of directories or files. Paths can be defined once and referred to multiple times, easing the development and maintenance of build files. For example, a Java compilation task can use a path reference to determine the classpath to use.
ibm.com/redbooks