Apache Ant

Apache Ant is a Java based build tool from Apache Software Foundation. Apache Ant's build files are written in XML and they take advantage of being open standard, portable and easy to understand. ANT stands for Another Neat Tool. It is a Java-based build tool from Apache. Before going into the details of Apache Ant, let us first understand why we need a build tool in the first place.

Need for a Build Tool

On an average, a developer spends a substantial amount of time doing mundane tasks like build and deployment that include:

> Compiling the code

> Packaging the binaries

> Deploying the binaries to the test server

> Testing the changes

> Copying the code from one location to another

To automate and simplify the above tasks, Apache Ant is useful. It is an Operating System build and deployment tool that can be executed from the command line.

History of Apache Ant

> Ant was created by James Duncan Davidson (the original author of Tomcat).

> It was originally used to build Tomcat, and was bundled as a part of Tomcat distribution.

> Ant was born out of the problems and complexities associated with the Apache Make tool.

> Ant was promoted as an independent project in Apache in the year 2000. The latest version of

Apache Ant as on May 2014 is 1.9.4.

Features of Apache Ant

> Ant is the most complete Java build and deployment tool available.

> Ant is platform neutral and can handle platform specific properties such as file separators.

> Ant can be used to perform platform specific tasks such as modifying the modified time of a file using ‘touch’ command.

> Ant scripts are written using plain XML. If you are already familiar with XML, you can learn Ant pretty quickly.

> Ant is good at automating complicated repetitive tasks.

> Ant comes with a big list of predefined tasks.

> Ant provides an interface to develop custom tasks.

> Ant can be easily invoked from the command line and it can integrate with free and commercial IDEs.

Apache Ant Ant is distributed under the Apache Software License, a fully-fledged open source license certified by the open source initiative. The latest Apache Ant version, including its full-source code, class files, and documentation can be found at http://ant.apache.org.

Installing Apache Ant

It is assumed that you have already downloaded and installed Java Development Kit (JDK) on your computer. If not, please follow the instructions

Ensure that the JAVA_HOME environment variable is set to the folder where your JDK is installed.

Download the binaries from http://ant.apache.org

Unzip the zip file to a convenient location c:\folder. using Winzip, winRAR, 7-zip or similar tools.

Create a new environment variable called ANT_HOME that points to the Ant installation folder, in this case c:\apache-ant-1.8.2-bin folder.

Append the path to the Apache Ant batch file to the PATH environment variable. In our case this would be the c:\apache-ant-1.8.2-bin\bin folder.

Verifying Apache Ant Installation

To verify the successful installation of Apache Ant on your computer, type ant on your command prompt.

You should see an output similar to:

C:\>ant -version Apache Ant(TM) version 1.8.2 compiled on December 20 2010

If you do not see the above output, then please verify that you have followed the installation steps properly.

Installing Eclipse

Ant with Eclipse IDE. Hence, if you have not installed Eclipse already, please download and install Eclipse