Project and Target

The <project> and <target> elements are not tasks; however, they are found in every buildfile. Each buildfile must contain one <project> element, which in turn contains one or more <target> elements.


The <project> element is found in every buildfile, and is always the root XML element. It specifies a descriptive name for the buildfile, the default target, and the base directory. It also contains all of the <target> in the buildfile.


basedir (all, File, N)

The base directory from which all relative paths in the project are computed. Defaults to the directory containing the buildfile. And if this attribute is not specified, then you can set the basedir property when you invoke Ant as follows: ant -Dbasedir= mydirectory target

default (all, String, Y)

Specifies the target to execute when no target is specified on the ant command line.

name (all, String, N)

A descriptive name for the Ant project. This name is used for documentation purposes and is displayed when you type ant -projecthelp.


0..n nested <description> elements (1.4)

Defines a description of the project for documentation purposes. Each <description> element contains text content. Multiple descriptions are appended and displayed when you type ant -projecthelp.

0..n nested <filelist> elements (all)

Defines project-wide filelists that can be referenced throughout the buildfile. See Chapter 4 for a description of the filelist DataType.

0..n nested <fileset> elements (all)

Defines project-wide ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.