Configuration
Once
Ant is installed properly, it requires very little additional
configuration. Provided the ant.bat batch file
(or ant shell script) is installed in a
directory that is included in your system path, you should be able to
run Ant from any command prompt.
You do not technically have to use the provided
ant or ant.bat script to
run Ant. You can run Ant manually, as long as the following items are
configured:[11]
The system
CLASSPATHincludesant.jarand any JAXP-compliant XML parser.For JDK 1.1,
classes.zipmust be added to theCLASSPATH. For Java 2,tools.jarmust be added. This is necessary for tasks likejavac.Many tasks require that the
ant.homeJava system property be set to the Ant installation directory. This is accomplished by launching the JVM with the-Dflag, as shown shortly.JAR files for optional tasks must be added to the
CLASSPATH.
Provided that these items are all set properly, you can use the following command to invoke Ant:[12]
java -Dant.home=pathToAnt org.apache.tools.ant.MainTip
Understanding how to set up and run Ant manually might be useful if you are making customizations to Ant and wish to run it using your IDE’s debugger.
XML Issues
Early versions of Ant (prior to
Version 1.4) include Sun’s Java API for XML Parsing
(JAXP) Version 1.0. Ant Versions 1.4 and later ship with JAXP 1.1, as
described in the next paragraph. JAXP is an API allowing Java
programs to use XML parsers from different vendors in a portable way.
The JAXP JAR files, jaxp.jar ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access