Web Server Setup: 08 - Apache ANT

Apache ANT ()

“          Binary downloads of the Ant build tool are available from http://ant.apache.org/. This manual assumes you are using Ant 1.8 or later. The instructions may also be compatible with other versions, but this has not been tested.

Download and install Ant. Then, add the bin directory of the Ant distribution to your PATH environment variable, following the standard practices for your operating system platform. Once you have done this, you will be able to execute the ant shell command directly.        “

The Short Story

To get up and running with the binary edition of Ant quickly, follow these steps:

  1. Make sure you have a Java environment installed, See System Requirements for details.
  2. Download Ant. See Binary Edition for details.
  3. Uncompress the downloaded file into a directory.
  4. Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH. See Setup for details.
  5. Optionally, from the ANT_HOME directory run ant -f fetch.xml -Ddest=system to get the library dependencies of most of the Ant tasks that require them. If you don't do this, many of the dependent Ant tasks will not be available. See Optional Tasks for details and other options for the -Ddest parameter.
  6. Optionally, add any desired Antlibs. See Ant Libraries for a list.

Note that the links in the list above will give more details about each of the steps, should you need them. Or you can just continue reading the rest of this document.

The short story for working with the Ant source code (not needed if you are working with the binary edition) is:

  1. Get the source code. See Source Edition for details.
  2. Build Ant. See Building Ant for details.

For the full story, continue reading.

 

Windows Note:

 

The ant.bat script makes use of three environment variables - 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 Environment Variable

  • ANT_HOME = D:\xampp\ant
D:\xampp\ant\bin>ant
Buildfile: build.xml does not exist!
Build failed