Apache Ant is a Java library and command-line tool to automate the repetitive tasks and helps to build software. Ant is flexible and does not impose coding conventions. It supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications.

Install Apache Ant 


1) Download Ant   
 
$ wget http://www.us.apache.org/dist/ant/binaries/apache-ant-1.9.2-bin.tar.gz
 
2) Extract using tar command
 
$ sudo tar xvfvz apache-ant-1.9.2-bin.tar.gz -C /opt
 
3) Check files if installed
 
$ sudo ln -s /opt/apache-ant-1.9.2 /opt/ant
 
4) Setup ANT environment variable by creating file called ant.sh under /etc/profile.d/ directory
 
$ vi /etc/profile.d/ant.sh
 
5) Add the following contents
 
#!/bin/bash
ANT_HOME=/opt/ant
PATH=$ANT_HOME/bin:$PATH
export PATH ANT_HOME
export CLASSPATH=.
 
6) Save and close the file. Make it executable using the following command
 
$ chmod +x /etc/profile.d/ant.sh
 
7) Set the environment variables permanently by running the following command
 
$ source /etc/profile.d/ant.sh
 
8) Reboot your system.
 
9) Check the ant version using command
 
$ ant -version
 
10) Done