Introduction to Apache Ant
The Apache Ant package is a
Java-based build tool. In theory,
it is kind of like make, but without make's wrinkles. Ant is different. Instead of a model that is
extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell
commands, the configuration files are XML-based, calling out a
target tree that executes various tasks. Each task is run by an
object that implements a particular task interface.
This package is known to build and work properly using an LFS-7.6
platform.
Package Information
Additional Downloads
Apache Ant Dependencies
Required
A JDK (Java Binary or OpenJDK-1.7.0.65/IcedTea-2.5.2)
and GLib-2.40.0
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/apache-ant
Installation of Apache Ant
Unpack and copy the junit and
hamcrest jar files to the local
directory tree.
tar -xvf ../hamcrest-1.3.tgz &&
cp -v ../junit-4.11.jar \
hamcrest-1.3/hamcrest-core-1.3.jar lib/optional
If you wish to install the documentation, unpack it:
tar -xvf ../apache-ant-1.9.4-manual.tar.bz2
Install Apache Ant by running the
following commands:
The unit regression tests are performed during the build step below
unless JUnit is not installed.
Now, as the root
user:
./build.sh -Ddist.dir=/opt/ant-1.9.4 dist &&
ln -v -sfn ant-1.9.4 /opt/ant
Note
Make sure the JAVA_HOME environment variable is set for the
root
user.
Install the documentation as the root
user:
install -m755 -d /opt/ant-1.9.4/docs &&
cp -Rv apache-ant-1.9.4/* /opt/ant-1.9.4/docs
Command Explanations
cp -v ...
lib/optional: This command copies the JUnit and
hamcrest jar files into the directory where Apache Ant will look
for it.
./build.sh -Ddist.dir=/opt/ant-1.9.4
dist: This command does everything. It builds,
tests, then installs the package into /opt/ant-1.9.4
.
ln -v -sfn ant-1.9.4
/opt/ant: This command is optional, and creates a
convenience symlink.
Configuring Apache Ant
Config
Files
/etc/ant/ant.conf
, ~/.ant/ant.conf
, and ~/.antrc
Configuration Information
Some packages will require ant to be in the search path
and the $ANT_HOME
environment variable
defined. Satisfy these requirements by adding the following lines
to /etc/profile
or to individual
user's ~/.profile
or ~/.bashrc
files:
export PATH=$PATH:/opt/ant/bin
export ANT_HOME=/opt/ant