Tuesday, November 2, 2010

ANT - Installation of ANT - Part 1

On a journey to learn a long long pending task on my list "PDE Build", i realised the importance of ANT and how useful can it get when coming to Automating the Build System of any Java Application. Therefore decided to put my PDE Build learning on hold and continue with understanding of ANT. Part of this is this blog of mine. Hope it helps people who are trying to learn ANT. Definition of ANT as defined by the Makers of ANT, from http://ant.apache.org/
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.

Prerequisites :: JDK to be installed and JAVA_HOME variable has to be set.

Installing ANT
1. Download Latest Build of ANT. Click Here
2. Extract the same into desired folder. (For e.g. c:/ant)
3. Create ANT_HOME variable in Environment Variable.

  • a. Right Click on My Computer and Select Properties.
    b. In System Properties, select Advanced
    c. Click on Environment Variables
    d. In User Variables, click on New
    e. Variable Name :: ANT_HOME
    Variable Value :: Location of ANT as in Step 2.
    f. Check if “path” variable exists.
    a. If path variable exists, edit the same and append %ANT_HOME%/bin;
    b. Else create path variable by repeating Step ‘d’ and Step ‘e’.
    Variable Name :: path
    Variable Value :: %ANT_HOME%/bin;

4. After completing Step 3, its time to test ANT.

  • a. Open Command Line
    b. Type ANT
    c. If you get the below output, then ANT is installed properly
    Buildfile: build.xml does not exist!
    Build failed
You have successfully installed ANT. Now in the next part lets look at how to work with ANT.

2 comments:

Stefan Baramov said...

I would advise to not use the latest Ant 1.8.1. It has several bugs that impact PDE Build. I would suggest 1.7.1.

Its_Me_Malai said...

Thanks Mate !! Sure will do that.
It will be awesome if you could list the problems that people are facing with 1.8.1 so that now one else repeats the same mistake.