1ANT(1) Apache Ant ANT(1)
2
3
4
6 ant - Java build tool
7
9 ant [OPTIONS] [TARGET [TARGET2 [TARGET3] ...]]
10
12 Apache Ant is a Java library and command-line tool whose mission is to
13 drive processes described in build files as targets and extension
14 points dependent upon each other. The main known usage of Ant is the
15 build of Java applications. Ant supplies a number of built-in tasks
16 allowing to compile, assemble, test and run Java applications. Ant can
17 also be used effectively to build non Java applications, for instance C
18 or C++ applications. More generally, Ant can be used to pilot any type
19 of process which can be described in terms of targets and tasks.
20
22 When no arguments are specified, Ant looks for a build.xml file in the
23 current directory and, if found, uses that file as the build file and
24 runs the target specified in the default attribute of the <project>
25 tag. To make Ant use a build file other than build.xml, use the
26 command-line option -buildfile file, where file is the name of the
27 build file you want to use (or a directory containing a build.xml
28 file).
29
30 If you use the -find [file] option, Ant will search for a build file
31 first in the current directory, then in the parent directory, and so
32 on, until either a build file is found or the root of the filesystem
33 has been reached. By default, it will look for a build file called
34 build.xml. To have it search for a build file other than build.xml,
35 specify a file argument. Note: If you include any other flags or
36 arguments on the command line after the -find flag, you must include
37 the file argument for the -find flag, even if the name of the build
38 file you want to find is build.xml.
39
40 You can also set properties on the command line. This can be done with
41 the -Dproperty=value option, where property is the name of the
42 property, and value is the value for that property. If you specify a
43 property that is also set in the build file (see the property task),
44 the value specified on the command line will override the value
45 specified in the build file. Defining properties on the command line
46 can also be used to pass in the value of environment variables; just
47 pass -DMYVAR=$MYVAR to Ant. You can then access environment variables
48 using the property task’s environment attribute.
49
50 Options that affect the amount of logging output by Ant are: -quiet,
51 which instructs Ant to print less information to the console; -verbose,
52 which causes Ant to print additional information to the console;
53 -debug, which causes Ant to print considerably more additional
54 information; and -silent which makes Ant print nothing but task output
55 and build failures (useful to capture Ant output by scripts).
56
57 It is also possible to specify one or more targets that should be
58 executed. When omitted, the target that is specified in the default
59 attribute of the project tag is used.
60
61 The -projecthelp option prints out a list of the build file’s targets.
62 Targets that include a description attribute are listed as "Main
63 targets", those without a description are listed as "Other targets",
64 then the "Default" target is listed ("Other targets" are only displayed
65 if there are no main targets, or if Ant is invoked in -verbose or
66 -debug mode).
67
69 -help, -h
70 print this message and exit
71
72 -projecthelp, -p
73 print project help information and exit
74
75 -version
76 print the version information and exit
77
78 -diagnostics
79 print information that might be helpful to diagnose or report
80 problems and exit
81
82 -quiet, -q
83 be extra quiet
84
85 -silent, -S
86 print nothing but task outputs and build failures
87
88 -verbose, -v
89 be extra verbose
90
91 -debug, -d
92 print debugging information
93
94 -emacs, -e
95 produce logging information without adornments
96
97 -lib <path>
98 specifies a path to search for jars and classes
99
100 -logfile <file>, -l <file>
101 use given file for log
102
103 -logger <classname>
104 the class which is to perform logging
105
106 -listener <classname>
107 add an instance of class as a project listener
108
109 -noinput
110 do not allow interactive input
111
112 -buildfile <file>, -file <file>, -f <file>
113 use given buildfile
114
115 -D<property>=<value>
116 use value for given property
117
118 -keep-going, -k
119 execute all targets that do not depend on failed target(s)
120
121 -propertyfile <name>
122 load all properties from file with -D properties taking precedence
123
124 -inputhandler <class>
125 the class which will handle input requests
126
127 -find <file>, -f <file>
128 search for buildfile towards the root of the filesystem and use it
129
130 -nice number
131 A niceness value for the main thread: 1 (lowest) to 10 (highest); 5
132 is the default
133
134 -nouserlib
135 Run ant without using the jar files from ${user.home}/.ant/lib
136
137 -noclasspath
138 Run ant without using CLASSPATH
139
140 -autoproxy
141 Java1.5+: use the OS proxy settings
142
143 -main <class>
144 override Ant’s normal entry point
145
147 ant
148 runs Ant using the build.xml file in the current directory, on the
149 default target.
150
151 ant -buildfile test.xml
152 runs Ant using the test.xml file in the current directory, on the
153 default target.
154
155 ant -buildfile test.xml dist
156 runs Ant using the test.xml file in the current directory, on the
157 target called dist.
158
159 ant -buildfile test.xml -Dbuild=build/classes dist
160 runs Ant using the test.xml file in the current directory, on the
161 target called dist, setting the build property to the value
162 "build/classes".
163
164 ant -lib /home/ant/extras
165 runs Ant picking up additional task and support jars from the
166 /home/ant/extras location
167
168 ant -lib one.jar;another.jar
169 adds two jars to Ants classpath.
170
172 The Ant wrapper script for Unix will source (read and evaluate) the
173 file ~/.antrc before it does anything. You can use the file, for
174 example, to set/unset environment variables that should only be visible
175 during the execution of Ant.
176
178 The wrapper scripts use the following environment variables (if set):
179
180 JAVACMD
181 full path of the Java executable. Use this to invoke a different
182 JVM than JAVA_HOME/bin/java.
183
184 ANT_OPTS
185 command-line arguments that should be passed to the JVM. For
186 example, you can define system properties or set the maximum Java
187 heap size here.
188
189 ANT_ARGS
190 Ant command-line arguments. For example, set ANT_ARGS to point to a
191 different logger, include a listener, and to include the -find
192 flag. Note: If you include -find in ANT_ARGS, you should include
193 the name of the build file to find, even if the file is called
194 build.xml.
195
197 java(1), make(1), mvn(1)
198
199
200
201ANT 10/16/2020 ANT(1)