JAVA_HOME
to your Java environment, ANT_HOME
to the directoryyou uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) toyour PATH
. See Setup for details.ANT_HOME
directory run ant -f fetch.xml -Ddest=system to get thelibrary dependencies of most of the Ant tasks that require them. If you don't do this, many of the dependent Ant taskswill not be available. See Optional Tasks for details and other options forthe -Ddest parameter.PATH
. If Ant starts behaving weirdly after installing something, trythe diagnostics advice.Filename or Path | Description |
---|---|
KEYS | PGP keyfile. It contains the PGP keys of Ant developers so you can 'trust' the distribution. |
RELEASE-NOTES-{version}.html | Release notes of the given version in HTML format. When upgrading your Ant installation you should have a look at the Changes that could break older environments section. |
ant-current-bin.zip | ZIP archive containing the compiled version of Ant in the last released version. It is recommended that you do not download the latest version this way, as the standard way of downloading described above will redirect you to a mirror closer to you, thus making the download faster for you and reducing the load on Apache servers. |
ant-current-src.zip | ZIP archive containing the sources of Ant. If you have this you can compile Ant. If you do not have the required dependencies, the classes depending on them are just not built. Again, it is preferred to use the standard way of getting the source package described above to make your download quicker and to reduce the load on Apache servers. |
ant-current-*.asc | Security file for checking the correctness of the zip file. This one is the PGP signature. |
ant-current-*.md5 | Security file for checking the correctness of the zip file. This one is the MD5 checksum. |
ant-current-*.sha1 | Security file for checking the correctness of the zip file. This one is the SHA1 checksum. |
ant-current-*.sha512 | Security file for checking the correctness of the zip file. This one is the SHA512 checksum. |
antlibs/ | This directory holds the Antlibs that are made of available by the Apache Ant project. Antlibs are bundles of Ant tasks that are not delivered as part of the Ant core but are available as optional downloads. |
binaries/ | The binaries directory holds specific Ant releases bundled in both ZIP and tar.gz archive formats. The named releases are in contrast to the ant-current-bin.zip file in the parent directory, which is always guaranteed to be the most current release of Ant. |
common/ | The common directory holds various files, such as the Apache License file that Ant is licensed under, that people may wish to examine without having to download the whole Ant distribution. |
source/ | The source directory holds the source code for specific Ant releases bundled in both ZIP and tar.gz archive formats. The named releases are in contrast to the ant-current-src.zip file in the parent directory, which is always guaranteed to hold the source code for the most current release of Ant. |
ANT_HOME
.ANT_HOME
is a long filename (i.e. a filename which is not of the format known as '8.3'). This is due to limitations in the OS's handling of the 'for'
batch file statement. It is recommended, therefore, that Ant be installed in a short, 8.3 path, such as C:Ant.ANT_HOME
environment variable to the directory where you installed Ant. On some operatingsystems, Ant's startup scripts can guess ANT_HOME
(Unix dialects and Windows NT descendants), but it isbetter to not rely on this behavior.JAVA_HOME
environment variable (see the Advanced sectionbelow). This should be set to the directory where your JDK is installed.ANT_HOME
, CLASSPATH
and JAVA_HOME
. Ensure that ANT_HOME
and JAVA_HOME
variables are set, and that they do not have quotes (either ' or ') and they do not end with or with /. CLASSPATH
should be unset or empty.%ANT_HOME%binant.bat
%JAVA_HOME%binjava.exe
%PATH%=...maybe-other-entries...;%ANT_HOME%bin;...maybe-other-entries...
ANT_HOME
is used by the launcher script for finding the libraries. JAVA_HOME
is used by thelauncher for finding the JDK/JRE to use. (JDK is recommended as some tasks require the Java tools.) If not set, thelauncher tries to find one via the %PATH%
environment variable. PATH
is set for userconvenience. With that set you can just start ant instead of alwaystyping the/complete/path/to/your/ant/installation/bin/ant.ANT_HOME/lib
. This makes the JAR files available to all Ant users and builds.${user.home}/.ant/lib
(since Ant 1.6). This allows different users to add new libraries toAnt. All JAR files added to this directory are available to command-line Ant.CLASSPATH
environment variable. Avoid this; it makes the JAR files visible to all Javaapplications, and causes no end of support calls. See below for details.<classpath>
accepted by the task itself. Since Ant 1.7.0, you can runthe <junit>
task without junit.jar in Ant's own classpath, so long as it is included(along with your program and tests) in the classpath passed when running the task.ANT_HOME
directory you should see afile called fetch.xml. This is an Ant script that you can run to install almost all the dependencies thatthe optional Ant tasks need.ANT_HOME
directory and execute the command:system
—store in Ant's lib directory (Recommended)user
—store in the user's home directoryoptional
—store in Ant's source code lib/optional directory, used when building Antsource codeCLASSPATH
Environment VariableCLASSPATH
environment variable is a source of many Ant support queries. As the round trip time fordiagnosis on the Ant user mailing list can be slow, and because filing bug reports complaining about 'ant.bat' notworking will be rejected by the developers as WORKSFORME 'this is a configuration problem, not a bug', you can saveyourself a lot of time and frustration by following some simple steps.CLASSPATH
. Ant does not need it, it only causes confusion and breaks things.CLASSPATH
, even if there is aspace in a directory. This will break Ant, and it is not needed.CLASSPATH
, as it breaksAnt's ability to quote the string. Again, this is not needed for the correct operation of the CLASSPATH
environment variable, even if a DOS directory is to be added to the path.CLASSPATH
environment variable by setting the -noclasspathoption on the command line. This is an easy way to test for classpath-related problems.CLASSPATH
problems is that Ant will not run with some error about not being able tofind org.apache.tools.ant.launch.Launcher
, or, if you have got the quotes/backslashes wrong,some very weird Java startup error. To see if this is the case, run ant -noclasspath or unsetthe CLASSPATH
environment variable.ANT_OPTS
environment variable. This is the best option for a non-mobile system. For alaptop, you have to change these settings as you roam. To set ANT_OPTS
:For csh/tcsh:For bash:For Windows, set the environment variable in the appropriate dialog box and open a new console or, by hand
ANT_ARGS
are probably the best solution. Setting properties on Ant's command linedo not work, because those are Ant properties being set, not JVM options. This means the following does not setup the command line:JAVA_HOME
or ANT_HOME
environment variables and the RPMinstaller will correctly place the ant executable on your path.ANT_HOME
environment variable is set, the JPackagedistribution will be ignored.$ANT_HOME/lib
, which, for JPackage isusually /usr/share/ant/lib. Another, less messy option is to create an .ant/lib subdirectoryof your home directory and place your non-JPackage Ant JARs there, thereby avoiding mixing JPackage libraries withnon-JPackage stuff in the same folder. More information on where Ant finds its libraries isavailable hereJAVA_HOME
environment variable is set.ant.home
must be set to the directory containingwhere you installed Ant. Again this is set by the Ant scripts to the value of the ANT_HOME
environmentvariable.ANT_OPTS
environment variable which can be used to supplyextra options to Ant. Some of the scripts also read in an extra script stored in the users home directory, which can beused to set such options. Look at the source for your platform's invocation script for details.JAVA_HOME
environment variable to the directory where the JDK isinstalled. See Installing Ant for examples on how to do this for your operating system.disttarget in Ant's own build.xml file.
ANT_HOME
directory, you can use:ANT_HOME
.chmod.fail
to false when starting the build like inJAR Name | Needed For | Available At |
---|---|---|
jakarta-regexp-1.4.jar | regexp type with mappers (if you do not wish to use java.util.regex) | https://attic.apache.org/projects/jakarta-regexp.html |
jakarta-oro-2.0.8.jar | regexp type with mappers (if you do not wish to use java.util.regex) or ftp task with commons-net 1.4.1 | https://attic.apache.org/projects/jakarta-oro.html |
junit.jar | junit task (may be in classpath passed to task rather than Ant's classpath) | https://junit.org/ |
xalan.jar | junitreport task | https://xml.apache.org/xalan-j/ |
antlr.jar | antlr task | https://www.antlr.org/ |
bsf.jar | script task Note: Ant 1.6 and later require Apache BSF 2.3.0 or later. Note: BSF 2.4.0 is needed to use a 1.5R4 or later versions of Rhino JavaScript. Note: BSF 2.4.0 uses Commons Logging so it needs the commons-logging.jar. | https://commons.apache.org/bsf/ |
Groovy JARs | Groovy Ant tasks with bindings or Groovy with script and scriptdef tasks | http://groovy-lang.org/ Use either groovy-ant for Groovy Ant tasks with bindings or groovy-bsf for Groovy with script and scriptdef tasks (or groovy-all) |
netrexx.jar | netrexxc task, Rexx with script task | https://www.ibm.com/software/awdtools/netrexx/library.html |
rhino.jar (included in Java 7 runtime, replaced by Nashorn in Java 8 and later, dropped with Java 15) | JavaScript with script task Note: Apache BSF 2.4.0 works only with Rhino 1.5R4 and later versions. | https://www.mozilla.org/rhino/ |
graalvm js.jar and js-scriptengine.jar | JavaScript with script task for Java 15 and later | Java 15 has dropped Nashorn and GraalVM JavaScript is meant to replace it - outside of the Java class library. Note GraalVM JavaScript is not a drop-in replacement for Nashorn, see the script task documentation for details. Also GraakVM JavaScript requires a couple of more dependencies, in particular GraalVM regex, truffle, the GraalVM SDK and ICU. |
jython.jar | Python with script task | https://www.jython.org/ |
jacl.jar and tcljava.jar | TCL with script task | http://tcljava.sourceforge.net/ |
jtcl.jar | TCL with script task | https://jtcl-project.github.io/jtcl/ |
BeanShell JAR(s) | BeanShell with script task. Note: Ant requires BeanShell version 1.3 or later | http://www.beanshell.org/ |
jruby.jar | Ruby with script task | https://jruby.org/ |
judo.jar | Judo language with script task | used to be at http://www.judoscript.org/ which is now not available anymore. |
commons-logging.jar | CommonsLoggingListener | https://commons.apache.org/logging/ |
log4j.jar | Log4jListener | https://logging.apache.org/log4j/ |
commons-net.jar | ftp, rexec and telnet tasks A minimum version of commons-net of 1.4.0 is needed to compile Ant, earlier versions did not support the full range of configuration options. jakarta-oro 2.0.8 is required together with commons-net 1.4.x at run time. Note: do not use commons-net 3.2 because of performance issues | https://commons.apache.org/net/ |
bcel.jar | classfileset data type, JavaClassHelper used by the ClassConstants filter reader and optionally used by ejbjar task for dependency determination | https://commons.apache.org/bcel/ |
jakarta.mail.jar | mail task and deprecatedmimemail task | https://eclipse-ee4j.github.io/mail/ |
activation.jar
| mail task with MIME encoding, and deprecatedmimemail task | https://github.com/eclipse-ee4j/jaf |
jdepend.jar | jdepend task | https://github.com/clarkware/jdepend |
resolver.jar 1.1 or later | xmlcatalog datatype only if support for external catalog files is desired | https://xerces.apache.org/xml-commons/components/resolver/ |
jsch.jar 0.1.55 or later | sshexec and scp tasks | http://www.jcraft.com/jsch/ |
JAI—Java Advanced Imaging | image task | https://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html |
jai-imageio-core.jar | imageio task for TIFF support on Java 8, as well as PCX, PNM, RAW support | https://github.com/jai-imageio/jai-imageio-core/releases |
XZ—XZ for Java 1.6 or later | xz and unxz tasks, xzresource, xz compression in tar/untar tasks | https://www.tukaani.org/xz/java.html |
JUnit 5 Platform jars:
| junitlauncher task. Additional libraries maybe needed depending on the selected test engines, details of which are available in that task's documentation | https://junit.org/junit5/ |
ANT_HOME/lib
CLASSPATH
problem, and run a diagnostics check to see what Ant thinks of its own state. Why the userlist, and not the developer list? Because there are more users than developers, so more people who can help you.