3.3 Running Ant

3.3.1 Problem

You want to run Ant.

3.3.2 Solution

The complete command-line syntax is as follows:

ant [options] [target [target2 [target3] ...]]

3.3.3 Discussion

Table 3-1 lists all of the Ant command-line options. This table applies to Ant Version 1.5.1.

Table 3-1. Ant command-line options



-buildfile file

-f file

-file file

Specify which buildfile to use. If omitted, Ant searches for a file named build.xml.


Pass name/value pairs as properties.


Write debugging information as the build progresses.


Write diagnostic information as the build progresses.


Write the log file in a way that Emacs understands.

-find file

Locate a buildfile. Start searching in this directory, then the parent directory, and so on until the file is found or the filesystem root is reached.


Show these options.

-inputhandler classname

Use a custom input handler class.

-listener classname

Use a custom build listener class.

-logfile file

-l file

Send messages to the specified file instead of the console.

-logger classname

Use a custom logger class.


Show a list of all targets in the buildfile.

-propertyfile name

Load all of the properties in the specified file. Properties specified with -D take precedence.



Suppress much of the output.



Write more information as the build progresses.


Show the version of Ant.

3.3.4 See Also

Type ant -help to see the Ant options.