|
|
38fd3c |
ant(1)
|
|
|
38fd3c |
======
|
|
|
38fd3c |
:doctype: manpage
|
|
|
38fd3c |
:man source: ANT
|
|
|
38fd3c |
:man manual: Apache Ant
|
|
|
38fd3c |
|
|
|
38fd3c |
NAME
|
|
|
38fd3c |
----
|
|
|
38fd3c |
ant - Java build tool
|
|
|
38fd3c |
|
|
|
38fd3c |
SYNOPSIS
|
|
|
38fd3c |
--------
|
|
|
38fd3c |
*ant* [OPTIONS] [TARGET [TARGET2 [TARGET3] ...]]
|
|
|
38fd3c |
|
|
|
38fd3c |
DESCRIPTION
|
|
|
38fd3c |
-----------
|
|
|
38fd3c |
Apache Ant is a Java library and command-line tool whose mission is to drive
|
|
|
38fd3c |
processes described in build files as targets and extension points dependent
|
|
|
38fd3c |
upon each other. The main known usage of Ant is the build of Java applications.
|
|
|
38fd3c |
Ant supplies a number of built-in tasks allowing to compile, assemble, test and
|
|
|
38fd3c |
run Java applications. Ant can also be used effectively to build non Java
|
|
|
38fd3c |
applications, for instance C or C++ applications. More generally, Ant can be
|
|
|
38fd3c |
used to pilot any type of process which can be described in terms of targets
|
|
|
38fd3c |
and tasks.
|
|
|
38fd3c |
|
|
|
38fd3c |
USAGE
|
|
|
38fd3c |
-----
|
|
|
38fd3c |
When no arguments are specified, Ant looks for a build.xml file in the current
|
|
|
38fd3c |
directory and, if found, uses that file as the build file and runs the target
|
|
|
38fd3c |
specified in the default attribute of the <project> tag. To make Ant use
|
|
|
38fd3c |
a build file other than build.xml, use the command-line option *-buildfile*
|
|
|
38fd3c |
file, where file is the name of the build file you want to use (or a directory
|
|
|
38fd3c |
containing a build.xml file).
|
|
|
38fd3c |
|
|
|
38fd3c |
If you use the *-find* [file] option, Ant will search for a build file first in
|
|
|
38fd3c |
the current directory, then in the parent directory, and so on, until either
|
|
|
38fd3c |
a build file is found or the root of the filesystem has been reached. By
|
|
|
38fd3c |
default, it will look for a build file called build.xml. To have it search for
|
|
|
38fd3c |
a build file other than build.xml, specify a file argument. Note: If you
|
|
|
38fd3c |
include any other flags or arguments on the command line after the *-find*
|
|
|
38fd3c |
flag, you must include the file argument for the *-find* flag, even if the name
|
|
|
38fd3c |
of the build file you want to find is build.xml.
|
|
|
38fd3c |
|
|
|
38fd3c |
You can also set properties on the command line. This can be done with the
|
|
|
38fd3c |
*-Dproperty*=value option, where property is the name of the property, and
|
|
|
38fd3c |
value is the value for that property. If you specify a property that is also
|
|
|
38fd3c |
set in the build file (see the property task), the value specified on the
|
|
|
38fd3c |
command line will override the value specified in the build file. Defining
|
|
|
38fd3c |
properties on the command line can also be used to pass in the value of
|
|
|
38fd3c |
environment variables; just pass *-DMYVAR*=$MYVAR to Ant. You can then access
|
|
|
38fd3c |
these variables inside your build file as ${MYVAR}. You can also access
|
|
|
38fd3c |
environment variables using the property task's environment attribute.
|
|
|
38fd3c |
|
|
|
38fd3c |
Options that affect the amount of logging output by Ant are: *-quiet*, which
|
|
|
38fd3c |
instructs Ant to print less information to the console; *-verbose*, which
|
|
|
38fd3c |
causes Ant to print additional information to the console; *-debug*, which
|
|
|
38fd3c |
causes Ant to print considerably more additional information; and *-silent*
|
|
|
38fd3c |
which makes Ant print nothing but task output and build failures (useful to
|
|
|
38fd3c |
capture Ant output by scripts).
|
|
|
38fd3c |
|
|
|
38fd3c |
It is also possible to specify one or more targets that should be executed.
|
|
|
38fd3c |
When omitted, the target that is specified in the default attribute of the
|
|
|
38fd3c |
project tag is used.
|
|
|
38fd3c |
|
|
|
38fd3c |
The *-projecthelp* option prints out a list of the build file's targets.
|
|
|
38fd3c |
Targets that include a description attribute are listed as "Main targets",
|
|
|
38fd3c |
those without a description are listed as "Other targets", then the "Default"
|
|
|
38fd3c |
target is listed ("Other targets" are only displayed if there are no main
|
|
|
38fd3c |
targets, or if Ant is invoked in *-verbose* or *-debug* mode).
|
|
|
38fd3c |
|
|
|
38fd3c |
OPTIONS
|
|
|
38fd3c |
-------
|
|
|
38fd3c |
|
|
|
38fd3c |
*-help, -h*::
|
|
|
38fd3c |
print this message and exit
|
|
|
38fd3c |
*-projecthelp, -p*::
|
|
|
38fd3c |
print project help information and exit
|
|
|
38fd3c |
*-version*::
|
|
|
38fd3c |
print the version information and exit
|
|
|
38fd3c |
*-diagnostics*::
|
|
|
38fd3c |
print information that might be helpful to diagnose or report problems and exit
|
|
|
38fd3c |
*-quiet, -q*::
|
|
|
38fd3c |
be extra quiet
|
|
|
38fd3c |
*-silent, -S*::
|
|
|
38fd3c |
print nothing but task outputs and build failures
|
|
|
38fd3c |
*-verbose, -v*::
|
|
|
38fd3c |
be extra verbose
|
|
|
38fd3c |
*-debug, -d*::
|
|
|
38fd3c |
print debugging information
|
|
|
38fd3c |
*-emacs, -e*::
|
|
|
38fd3c |
produce logging information without adornments
|
|
|
38fd3c |
*-lib <path>*::
|
|
|
38fd3c |
specifies a path to search for jars and classes
|
|
|
38fd3c |
*-logfile <file>, -l <file>*::
|
|
|
38fd3c |
use given file for log
|
|
|
38fd3c |
*-logger <classname>*::
|
|
|
38fd3c |
the class which is to perform logging
|
|
|
38fd3c |
*-listener <classname>*::
|
|
|
38fd3c |
add an instance of class as a project listener
|
|
|
38fd3c |
*-noinput*::
|
|
|
38fd3c |
do not allow interactive input
|
|
|
38fd3c |
*-buildfile <file>, -file <file>, -f <file>*::
|
|
|
38fd3c |
use given buildfile
|
|
|
38fd3c |
*-D<property>=<value>*::
|
|
|
38fd3c |
use value for given property
|
|
|
38fd3c |
*-keep-going, -k*::
|
|
|
38fd3c |
execute all targets that do not depend on failed target(s)
|
|
|
38fd3c |
*-propertyfile <name>*::
|
|
|
38fd3c |
load all properties from file with *-D* properties taking precedence
|
|
|
38fd3c |
*-inputhandler <class>*::
|
|
|
38fd3c |
the class which will handle input requests
|
|
|
38fd3c |
*-find <file>, -f <file>*::
|
|
|
38fd3c |
search for buildfile towards the root of the filesystem and use it
|
|
|
38fd3c |
*-nice number*::
|
|
|
38fd3c |
A niceness value for the main thread:
|
|
|
38fd3c |
1 (lowest) to 10 (highest); 5 is the default
|
|
|
38fd3c |
*-nouserlib*::
|
|
|
38fd3c |
Run ant without using the jar files from `${user.home}/.ant/lib`
|
|
|
38fd3c |
*-noclasspath*::
|
|
|
38fd3c |
Run ant without using `CLASSPATH`
|
|
|
38fd3c |
*-autoproxy*::
|
|
|
38fd3c |
Java1.5+: use the OS proxy settings
|
|
|
38fd3c |
*-main <class>*::
|
|
|
38fd3c |
override Ant's normal entry point
|
|
|
38fd3c |
|
|
|
38fd3c |
EXAMPLES
|
|
|
38fd3c |
--------
|
|
|
38fd3c |
*ant*::
|
|
|
38fd3c |
|
|
|
38fd3c |
runs Ant using the build.xml file in the current directory, on the default target.
|
|
|
38fd3c |
|
|
|
38fd3c |
*ant -buildfile test.xml*::
|
|
|
38fd3c |
|
|
|
38fd3c |
runs Ant using the test.xml file in the current directory, on the default target.
|
|
|
38fd3c |
|
|
|
38fd3c |
*ant -buildfile test.xml dist*::
|
|
|
38fd3c |
|
|
|
38fd3c |
runs Ant using the test.xml file in the current directory, on the target called dist.
|
|
|
38fd3c |
|
|
|
38fd3c |
*ant -buildfile test.xml -Dbuild=build/classes dist*::
|
|
|
38fd3c |
|
|
|
38fd3c |
runs Ant using the test.xml file in the current directory, on the target called dist, setting the build property to the value "build/classes".
|
|
|
38fd3c |
|
|
|
38fd3c |
*ant -lib /home/ant/extras*::
|
|
|
38fd3c |
|
|
|
38fd3c |
runs Ant picking up additional task and support jars from the /home/ant/extras location
|
|
|
38fd3c |
|
|
|
38fd3c |
*ant -lib one.jar;another.jar*::
|
|
|
38fd3c |
|
|
|
38fd3c |
adds two jars to Ants classpath.
|
|
|
38fd3c |
|
|
|
38fd3c |
FILES
|
|
|
38fd3c |
-----
|
|
|
38fd3c |
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.
|
|
|
38fd3c |
|
|
|
38fd3c |
ENVIRONMENT VARIABLES
|
|
|
38fd3c |
---------------------
|
|
|
38fd3c |
The wrapper scripts use the following environment variables (if set):
|
|
|
38fd3c |
|
|
|
38fd3c |
JAVACMD::
|
|
|
38fd3c |
full path of the Java executable. Use this to invoke a different JVM than JAVA_HOME/bin/java.
|
|
|
38fd3c |
ANT_OPTS::
|
|
|
38fd3c |
command-line arguments that should be passed to the JVM. For example, you can define system properties or set the maximum Java heap size here.
|
|
|
38fd3c |
ANT_ARGS::
|
|
|
38fd3c |
Ant command-line arguments. For example, set ANT_ARGS to point to a different logger, include a listener, and to include the *-find* flag.
|
|
|
38fd3c |
Note: If you include *-find* in ANT_ARGS, you should include the name of the build file to find, even if the file is called build.xml.
|
|
|
38fd3c |
|
|
|
38fd3c |
SEE ALSO
|
|
|
38fd3c |
--------
|
|
|
38fd3c |
java(1), make(1), mvn(1)
|