4.2. Installing and configuring ANT

4.2. Installing and configuring ANT

Apache Ant is a Java-based build tool. Instead of using an extended model using shell-based commands, Ant is extended using Java classes that uses XML-based configuration files. The configuration files call out a target tree that executes various tasks. Each task is run by an object that implements a particular Task interface. This gives you the ability to perform cross platform builds. Please also note that if needed, Ant provides an <exec> task that allows commands to be executed based on the Operating System it is executing on. For more information on Apache ANT please click here.

You will need to build your JBoss Application Server source files before you can run the application server. Firstly please download and install Apache Ant version 1.5 or 1.6 from the Apache Ant Archive. Apache Ant versions 1.5 and 1.6 have been tested on JBoss Application Server 4.2.2. Version 1.7 is not compatible and will give the following error if used.

[user@localhost]$ cd jboss/jboss-4.2.2.GA-src/build
[user@localhost build]$ ant
Buildfile: build.xml
check.inhibit.downloads:
check.proxy:
set.proxy.withoutauth:
...
BUILD FAILED
/jboss/jboss-4.2.2.GA-src/tools/etc/buildmagic/buildmagic.ent:28: Unsupported Ant version:

Apache Ant version 1.7.0 compiled on December 13 2006
Please install a version which is compatible with Ant 1.5 or 1.6.
Total time: 0 seconds

On downloading ANT, please unzip the compressed file and copy to the desired location. Like Java, you also need to set the environment variables for Apache ANT. The following example illustrates a desirable configuration for the .bashrc file. In the example the file is edited using the gnome text editor (gnome).

[user@localhost ~]$ gedit .bashrc
				
				# Source global definitions
				if [ -f /etc/bashrc ]; then
				/etc/bashrc
				fi
				......
				# User specific aliases and functions
				# The following are the environment variables for Java, ANT and JBoss						
				export JAVA_HOME=/usr/java/jdk1.5.0_14
				export PATH=$PATH:$JAVA_HOME/bin
				
				export ANT_HOME=/usr/ant/apache-ant-1.6.0
				export PATH=$PATH:$ANT_HOME/bin
				
			

To implement the changes you've made to the .bashrc file, type the following on a terminal.

[user@localhost ~]$ source .bashrc
				[user@localhost ~]$

If any errors are displayed, please check your .bashrc file for errors and ensure that all directory paths are correct.