Group Title: Building collections from Greenstone Archive XML files at the command prompt
Title: Installing Ant
Full Citation
Permanent Link:
 Material Information
Title: Installing Ant
Physical Description: Archival
Language: English
Creator: Sullivan, Mark V.
Publisher: UF Libraries
Place of Publication: Gainesville, FL
Publication Date: 2005
 Record Information
Bibliographic ID: UF00099460
Volume ID: VID00006
Source Institution: University of Florida
Holding Location: University of Florida
Rights Management: All rights reserved by the source institution and holding location.


This item has the following downloads:

InstallingAnt ( PDF )

Full Text
Installing Ant install..

Installing Ant

Getting Ant

Binary Edition

The latest stable version of Ant is available from the Ant web page If you like living on
the edge, you can download the latest version from

Source Edition

If you prefer the source edition, you can download the source for the latest Ant release from Again, if you prefer the edge, you can access the code as it is being
developed via CVS. The Jakarta website has details on accessing CVS. Please checkout the ant module. See
the section Building Ant on how to build Ant from the source code. You can also access the Ant CVS
repository on-line.

System Requirements

Ant has been used successfully on many platforms, including Linux, commercial flavours of Unix such as
Solaris and HP-UX, Windows 9x and NT, OS/2 Warp, Novell Netware 6 and MacOS X.

To build and use Ant, you must have a JAXP-compliant XML parser installed and available on your

The binary distribution of Ant includes the latest version of the Apache Xerces2 XML parser. Please see for more information about JAXP. If you wish to use a different JAXP-compliant
parser, you should remove xerceslmpl. j ar and xml-apis. j ar from Ant's lib directory. You can then
either put the jars from your preferred parser into Ant's lib directory or put the jars on the system classpath.

For the current version of Ant, you will also need a JDK installed on your system, version 1.2 or later.

Note: The Microsoft JVM/JDK is not supported.

Note #2: If a JDK is not present, only the JRE runtime, then many tasks will not work.

Installing Ant

The binary distribution of Ant consists of the following directory layout:

+--- bin // contains launcher scripts
+--- lib // contains Ant jars plus necessary dependencies
+--- docs // contains documentation
| +--- ant2 // a brief description of ant2 requirements

4/6/2010 6:20 PlV

1 of 6

Installing Ant

I +--- images // various logos for html documentation

I +--- manual // Ant documentation (a must read ;-
+--- etc // contains xsl goodies to:
// create an enhanced report from xml output of various tasks.
// migrate your build files and get rid of 'deprecated' warning
// ... and more ;-)

Only the bin and lib directories are required to run Ant. To install Ant, choose a directory and copy the
distribution file there. This directory will be known as ANT_HOME.

Windows 95, Windows 98 & Windows ME Note:
On these systems, the script used to launch Ant will have problems if
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.
On these systems you will also need to configure more environment space to cater
for the environment variables used in the Ant lauch script. To do this, you will
need to add or update the following line in the con fig. sys file

shell=c:\ c:\ /p /e:32768


Before you can run ant there is some additional set up you will need to do:

Add the bin directory to your path.
Set the ANT_HOME environment variable to the directory where you installed Ant. On some operating
systems the ant wrapper scripts can guess ANT_HOME (Unix dialects and Windows NT/2000) but it is
better to not rely on this behavior.
Optionally, set the JAVA HOME environment variable (see the Advanced section below). This should be
set to the directory where your JDK is installed.

Note: Do not install Ant's ant.jar file into the lib/ext directory of the JDK/JRE. Ant is an application, whilst
the extension directory is intended for JDK extensions. In particular there are security restrictions on the
classes which may be loaded by an extension.

Optional Tasks

Ant supports a number of optional tasks. An optional task is a task which typically requires an external library
to function. The optional tasks are packaged together with the core Ant tasks.

The external libraries required by each of the optional tasks is detailed in the Library Dependencies section.
These external libraries may either be placed in Ant's lib directory, where they will be picked up
automatically, or made available on the system CLASSPATH environment variable.

Windows and OS/2

Assume Ant is installed in c: \ant\. The following sets up the environment:

set ANT HOME=c:\ant

4/6/2010 6:20 PlV install..

2 of 6

Installing Ant install..

set JAVA HOME=c:\jdkl.2.2
set PATH-%PATH%;%ANT HOME%\bin

Unix (bash)

Assume Ant is installed in /usr/local/ant. The following sets up the environment:

export ANT HOME=/usr/local/ant
export JAVA HOME=/usr/local/jdk-l1.2.2
export PATH-${PATH}:${ANT HOME}/bin

Unix (csh)

setenv ANT HOME /usr/local/ant
setenv JAVA HOME /usr/local/jdk-1.2.2
set path=( $path $ANT HOME/bin )


There are lots of variants that can be used to run Ant. What you need is at least the following:

The classpath for Ant must contain ant. j ar and any jars/classes needed for your chosen
JAXP-compliant XML parser.
When you need JDK functionality (such as for the javac task or the rmic task), then for JDK 1.1, the
classes. zip file of the JDK must be added to the classpath; for JDK 1.2 or JDK 1.3, tools. jar must
be added. The scripts supplied with Ant, in the bin directory, will add the required JDK classes
automatically, if the JAVA HOME environment variable is set.
When you are executing platform-specific applications, such as the exec task or the cvs task, the
property ant. home must be set to the directory containing where you installed Ant. Again this is set by
the Ant scripts to the value of the ANT_HOME environment variable.

The supplied ant shell scripts all support an ANT_OPTS environment variable which can be used to supply
extra options to ant. Some of the scripts also read in an extra script stored in the users home directory, which
can be used to set such options. Look at the source for your platform's invocation script for details.

Building Ant

To build Ant from source, you can either install the Ant source distribution or checkout the ant module from

Once you have installed the source, change into the installation directory.

Set the JAVA HOME environment variable to the directory where the JDK is installed. See Installing Ant for
examples on how to do this for your operating system.

Note: The bootstrap process of Ant requires a greedy compiler like Sun's javac or jikes. It does not work with
gcj or kjc.

Make sure you have downloaded any auxiliary jars required to build tasks you are interested in. These should
either be available on the CLASSPATH or added to the lib directory. See Library Dependencies for a list of
jar requirements for various features. Note that this will make the auxiliary jars available for the building of
Ant only. For running Ant you will still need to make the jars available as described under Installing Ant.

4/6/2010 6:20 PlV

3 of 6

Installing Ant install..

Your are now ready to build Ant:

build -Ddist.dir= dist (Windows) -Ddist.dir= dist (Unix)

This will create a binary distribution of Ant in the directory you specified.

The above action does the following:

If necessary it will bootstrap the Ant code. Bootstrapping involves the manual compilation of enough
Ant code to be able to run Ant. The bootstrapped Ant is used for the remainder of the build steps.
Invokes the bootstrapped Ant with the parameters passed to the build script. In this case, these
parameters define an Ant property value and specify the "dist" target in Ant's own build. xml file.

On most occasions you will not need to explicitly bootstrap Ant since the build scripts do that for you. If
however, the build file you are using makes use of features not yet compiled into the bootstrapped Ant, you
will need to manually bootstrap. Run bootstrap. bat (Windows) or bootstrap. sh (UNIX) to build a new
bootstrap version of Ant.

If you wish to install the build into the current ANT_HOME directory, you can use:

build install (Windows)

build. sh install (Unix)

You can avoid the lengthy Javadoc step, if desired, with:

build install-lite (Windows) install-lite (Unix)

This will only install the bin and lib directories.

Both the install and install-lite targets will overwrite the current Ant version in ANT_HOME.

Library Dependencies

The following libraries are needed in your CLASSPATH or in the install directory's lib directory if you are
using the indicated feature. Note that only one of the regexp libraries is needed for use with the mappers (and
Java 1.4 and higher includes a regexp implementation which Ant will find automatically). You will also need
to install the Ant optional jar containing the task definitions to make these tasks available. Please refer to the
Installing Ant / Optional Tasks section above.

[Jar Name Needed For A'ailable A.
Ifyoii use JDK 1.4, an \SL
An XSL transformer is already included,
transformer so you need not do anything
,;t\ le task special.
like Xalan or special.

4/6/2010 6:20 PlV

4 of 6

Installing Ant install..
* XSL:P : used to live at
http://www.clc-, but the
link doesn't work any longer
and we are not aware of a
replacement site.

akara- reue\|p type with mappers http://jakarta.apache. org/regexp/

jakarta- rege\p t) pe \ ith mappers and the perftorce tasks
0-2.0.7.jar To use the FTP task, you need jakarta-oro 2.0.1 or
later. and conimmons-net
unit 1ar liunit tasks httpI \\\\\\ limit Or'
\alan ar lunitreport task Ittp \Iml apache oru, \alan-i

st\ lebook jar st\ lebook taslk C \ repoitorN of
Ihttp \ml apache org
Build from the gzip compress tar
testlet jar deprecated test task archive in
anti ar anti task http \\\\\\ aintlor u
sciirlt task
bsf lar Note Ant 1 o and later require Apache BSF, not the http lakarta apache org; bsf
IBM version. I.e. you need BSF 2.3.0-rcl or later.
Gioo\ \\ itlh SCnipt and scriptdef tasks
You need to get the groovy jar and two asm jars from a
Groovy jars oo\ v installation. The jars are groovy-[version].jar, The asm jars are also available from
asm-[vesion].jar and asm-util-[version].jar. As of the creators of asm -
groo\ v version 1.0-beta-7, the jars are groovy-1.0-beta-
7.jar, asm-1.4.3.jar and asm-util-1.4.3.jar.
http \\\\\\2 hurnsle\ ibm corn
netrexx.jar netre\\ task, Rexx with the script task /netrexx/

is jar If you use Apache BSF 2.3.0-rcl, you must use rhino
1.5R3 later versions of BSF work with 1.5R4 as well.
P) thon \\ ith script task
JNthon.jar Warning: jython.jar also contains classes from
jakarta-oro. Remove these classes if you are also using
jpython.jar Python with script task deprecated, jython is the
preferred engine I
lacl air and hLtp t\\w\\ scriptics coin softtalre
tclja. C L x\ ith script taIsk I-, taa,


BeanShell \\ith script task
Note: Ant 1.6 and later require BeanShell version 1.3

4/6/2010 6:20 PNV

5 of 6

Installing Ant install..

or later
jruby.jar Ruby with script task
iudo .ar Judoscript with script task h/index.html
__ I/index.html
commoins- m. Ip akarta apache oru commons
.onunons- C omnu onsLouinL istener
lou'ginlu ai C omoL -u itee lou'Iinndex html
httlj lakairta apache oru lou,-4
lou|- lar Lou-lListener locs inle\ html

ftp, rexec and telnet tasks
jakarta-oro 2.0.1 or later is required in any case
commons- together with commons-net.
net jar For all users, a minimum version of commons-net of /net/index.html
1.2.2 is recommended. Earlier versions did not support
autodetection of s\ stem t\ pe or had sinificaint biius
classfileset data t pe, Ja\ aClassHelper used by the
bcel.jar ClassConstants filter reader and optionally used by
ejbiar for dependence\ determination
http al a sun coim products
mail lar Mail task with Mime encoding, and the MimeMail task
Support for SMTP over TLS/SSL
isse jar in the Mail task
Already included in jdk 1.4
http ://java. sun. comrn/products
activation.jar Mail task with Mime encoding, and the MimeMail task /javabeans/asow/jafhtml

jdepend.jar depend task Ip clar-k-e coin ;otpaie
l_ J/JDepend.html
reol\ el. Jar \mlcatalou, datat\ pe wn/h ii1 \/II// I I/ \t Ic/Ih .
1.1beta or http.,, commons,.
later i ,ti/'t,' files is desired
later *
1http \\\\\\ Icrat't corn
Isclh lar sshexec and scp tasks /. h /. t
JAI Jan\ a
v d i ag thttp a' a sun coin products a' a-
Advanded image task mdaj
ai^ nfl umedia/jiai/

icontiract task
\\-arning the icontactjari file contains also antlr
classes http://www.reliable-systems. com
To make the antlr task work properly, remove /tools/
antlr/ANTLRGrammarParseBehavior. class from the
contract jar file installed under tANT HOME /lib

4/6/2010 6:20 PlV

Copyright 2000-2004 The Apache Software Foundation. All rights Reserved.

6 of 6

University of Florida Home Page
© 2004 - 2010 University of Florida George A. Smathers Libraries.
All rights reserved.

Acceptable Use, Copyright, and Disclaimer Statement
Last updated October 10, 2010 - - mvs