reosoftproductions.com
RODNEY AND ARLYN'S WEB SITE
Big Data

Ant

Ant

Navigation

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.

Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".

Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.

Install

Download Ant

Use the wget command to download the file. The following is for the 1.9.7 version:

cd ~/Downloads
wget http://www-us.apache.org/dist//ant/binaries/apache-ant-1.9.7-bin.tar.gz

This will download the tar file to your /home/hduser/Downloads directory. Verify the download.

ls -la

This should return something like:

total 5480
drwxr-xr-x.  3 hduser hduser      59 Apr 24 19:49 .
drwx------. 16 hduser hduser    4096 Apr 24 16:43 ..
-rw-rw-r--.  1 hduser hduser 5601575 Apr 12 04:15 apache-ant-1.9.7-bin.tar.gz

Uncompress the file with:

  tar -zxvf apache-ant-1.9.7-bin.tar.gz

Your Downloads directory should now have an ant directory:

drwxr-xr-x.  6 hduser hduser    4096 Apr  8 23:38 apache-ant-1.9.7

Move the Ant files to the /usr/local/ant directory.

sudo mv /home/hduser/Downloads/apache-ant-1.9.7 /usr/local/ant
ls -la /usr/local/ant

Some modifications are required in the .bashrc file.

vi ~/.bashrc

Add the following lines to the file:

# Ant Home
export ANT_HOME=/usr/local/ant
export PATH=$PATH:$ANT_HOME/bin

Use the following command to execute the ~/.bashrc file.

source ~/.bashrc

Test the Ant installation with this simple command:

ant -help
/usr/local/ant/bin/ant [script options] [options] [target [target2 [target3] ..]]
Script Options:
  --help, --h            print this message and ant help
  --noconfig             suppress sourcing of /etc/ant.conf,
                         $HOME/.ant/ant.conf, and $HOME/.antrc
                         configuration files
  --usejikes             enable use of jikes by default, unless
                         set explicitly in configuration files
  --execdebug            print ant exec line generated by this
                         launch script
  
ant [options] [target [target2 [target3] ...]]
Options: 
  -help, -h              print this message and exit
  -projecthelp, -p       print project help information and exit
  -version               print the version information and exit
  -diagnostics           print information that might be helpful to
                         diagnose or report problems and exit
  -quiet, -q             be extra quiet
  -silent, -S            print nothing but task outputs and build failures
  -verbose, -v           be extra verbose
  -debug, -d             print debugging information
  -emacs, -e             produce logging information without adornments
  -lib             specifies a path to search for jars and classes
  -logfile         use given file for log
    -l                     ''
  -logger     the class which is to perform logging
  -listener   add an instance of class as a project listener
  -noinput               do not allow interactive input
  -buildfile       use given buildfile
    -file                  ''
    -f                     ''
  -D=   use value for given property
  -keep-going, -k        execute all targets that do not depend
                         on failed target(s)
  -propertyfile    load all properties from file with -D
                         properties taking precedence
  -inputhandler   the class which will handle input requests
  -find            (s)earch for buildfile towards the root of
    -s             the filesystem and use it
  -nice  number          A niceness value for the main thread:                  
       1 (lowest) to 10 (highest); 5 is the default
  -nouserlib             Run ant without using the jar files from
          ${user.home}/.ant/lib
  -noclasspath           Run ant without using CLASSPATH
  -autoproxy             Java1.5+: use the OS proxy settings
  -main           override Ant's normal entry point

Version

To check the version of Ant that is currently installed, use:

ant -version

You should see something like this:

hduser> ant -version
Apache Ant(TM) version 1.9.2 compiled on June 10 2014

Uninstall (Yum)

To uninstall Ant, use the following command:

sudo yum remove ant