ant [OPTIONS] [TARGET [TARGET2 [TARGET3] ...]]
Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
When no arguments are specified, Ant looks for a build.xml file in the current directory and, if found, uses that file as the build file and runs the target specified in the default attribute of the <project> tag. To make Ant use a build file other than build.xml, use the command-line option -buildfile file, where file is the name of the build file you want to use (or a directory containing a build.xml file).
If you use the -find [file] option, Ant will search for a build file first in the current directory, then in the parent directory, and so on, until either a build file is found or the root of the filesystem has been reached. By default, it will look for a build file called build.xml. To have it search for a build file other than build.xml, specify a file argument. Note: If you include any other flags or arguments on the command line after the -find flag, you must include the file argument for the -find flag, even if the name of the build file you want to find is build.xml.
You can also set properties on the command line. This can be done with the -Dproperty=value option, where property is the name of the property, and value is the value for that property. If you specify a property that is also set in the build file (see the property task), the value specified on the command line will override the value specified in the build file. Defining properties on the command line can also be used to pass in the value of environment variables; just pass -DMYVAR=$MYVAR to Ant. You can then access environment variables using the property task's environment attribute.
Options that affect the amount of logging output by Ant are: -quiet, which instructs Ant to print less information to the console; -verbose, which causes Ant to print additional information to the console; -debug, which causes Ant to print considerably more additional information; and -silent which makes Ant print nothing but task output and build failures (useful to capture Ant output by scripts).
It is also possible to specify one or more targets that should be executed. When omitted, the target that is specified in the default attribute of the project tag is used.
The -projecthelp option prints out a list of the build file's targets. Targets that include a description attribute are listed as "Main targets", those without a description are listed as "Other targets", then the "Default" target is listed ("Other targets" are only displayed if there are no main targets, or if Ant is invoked in -verbose or -debug mode).
-help, -h
-projecthelp, -p
-version
-diagnostics
-quiet, -q
-silent, -S
-verbose, -v
-debug, -d
-emacs, -e
-lib <path>
-logfile <file>, -l <file>
-logger <classname>
-listener <classname>
-noinput
-buildfile <file>, -file <file>, -f <file>
-D<property>=<value>
-keep-going, -k
-propertyfile <name>
-inputhandler <class>
-find <file>, -f <file>
-nice number
-nouserlib
-noclasspath
-autoproxy
-main <class>
ant
ant -buildfile test.xml
ant -buildfile test.xml dist
ant -buildfile test.xml -Dbuild=build/classes dist
ant -lib /home/ant/extras
ant -lib one.jar;another.jar
The Ant wrapper script for Unix will source (read and evaluate) the file ~/.antrc before it does anything. You can use the file, for example, to set/unset environment variables that should only be visible during the execution of Ant.
The wrapper scripts use the following environment variables (if set):
JAVACMD
ANT_OPTS
ANT_ARGS