Running Ant

Problem

You want to run Ant.

Solution

The complete command-line syntax is as follows:

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

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

Option

Description

-buildfile file

-f file

-file file

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

-D property = value

Pass name/value pairs as properties.

-debug

Write debugging information as the build progresses.

-diagnostics

Write diagnostic information as the build progresses.

-emacs

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.

-help

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.

-projecthelp

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.

-quiet

-q

Suppress much of the output.

-verbose

-v

Write more information as the build progresses.

-version

Show the version of Ant.

See Also

Type ant -help to see ...

Get Java Extreme Programming Cookbook 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.