Name

ant

Synopsis

Invokes Ant on a specific target in another buildfile. This is particularly useful for large projects that break up the build process into multiple Ant buildfiles, each of which builds a smaller portion of the overall application.

It instantiates a new Ant project (as an instance of the org.apache.tools.ant.Project class). The way that properties propagate from the calling project to the new project has evolved with different versions of Ant. In Ant 1.1, the properties of the calling project are visible in the new project. If both projects define the same property, the calling project takes precedence. Ant 1.2 added the ability to specify nested <property> elements as shown later in this section, and Ant 1.4 added the inheritall attribute.

This task sets the ant.file property in the newly created Project object to the same value as the calling project, which is the name of the buildfile.

Attributes

antfile (all, String, N)

The name of the buildfile to invoke. Defaults to build.xml.

dir (all, File, N)

The base directory used by the new project; the antfile attribute is relative to the directory specified by dir. Defaults to the current working directory.

inheritall (1.4, boolean, N)

Controls how properties are passed from the current project to the new project. Defaults to true, meaning that all properties in the current project are available in the new project. This is how Ant versions prior to 1.4 work. If set to false, properties defined in the current project are not ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.