How to install ANT, and how to run a simple ANT script

April 30th, 2009 by Giridhar | Posted under Howtos, Linux.

How to install ant , and run a simple ANT script.

ant basic script and howtoWhat is ANT
Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make’s wrinkles.Build tool is used to build a fully installable application from the source code.Build Tool is an inevitable component of Release engineering.
Example.
•    Windows Installer
•    Install shield
•    Make
•    gnumake
•    jam
•    AntHill version 1.8.0. Entry last updated on Jan 21, 2006
•    AntHill Pro version 2.5.0. Entry last updated on Jan 21, 2006
•    Continuum version 1.0.2. Entry last updated on Feb 6, 2006
•    CruiseControl version 2.0.1. Entry last updated on Jan 21, 2006
•    Luntbuild version 1.3. Entry last updated on Jan 21, 2006
•    Test-AutoBuild version 1.1.3. Entry last updated on Jan 21, 2006
•    OpenMake Mojo 7.0

Prerequisites

JAVA 1.4 or above

Steps to install ANT and Run a simple Hello world  ANT script

1. Download ANT 1.7.1 from ant.apache.org, unzip it to a directory
2. Make sure JAVA_HOME is set on your windows PC c:\>echo %JAVA_HOME%
3. Set ANT_HOME in windows environment variables
4. Set PATH for ANT, C:\ant.1.7.1\bin
5. Go to command prompt test your ant installation by typing c:\> ant

Buildfile: build.xml does not exist!
Build failed

this error is because , by default ant try to find a build.xml file in current working dir.

6. Create a build.xml and place it on current dir. and run ant again.
7. All set
8. try this ant -f build1.xml goodbye

Command reference

http://ant.apache.org/manual/index.html

— build.xml ——–
<project name=”hello” default=”hello”>
<target name=”hello”>
<echo message=”Hello, World”/>
</target>
</project>

—-build1.xml ——–
<project name=”hello” default=”hello”>
<target name=”hello”>
<echo message=”Hello, World”/>
</target>

<target name=”goodbye”>
<echo message=”Goodbye, end of Hello world script”/>
</target>
</project>

Need more info ?


Is this article useful ?, please comment (why should I comment ?)

Tags: , , ,

Comments

5 Responses to “How to install ANT, and how to run a simple ANT script”
  1. Bronzee says:

    this is what I was looking for , its simple to follow

    thanks a lot

  2. pradeepa says:

    Great help 4 me,It’s simple and easy reading,Repeat it’s great,
    Thanks a lot.

  3. muzika says:

    Good article, thanks. Could you explain the third paragraph more please? Visit,

  4. Daniel says:

    God, am I the only retarded one? I just can’t understand this kind of installation tutorial. HOW THE HELL do I set the windows environment variables? Sorry, i’m a little irritated by the fact that every tutorial i look up for this can’t bring itself to explain that apparently simple process. To me, it looks like its missing words.

  5. Jithu says:

    You explained it in a simple and staright forward way without missing any steps..
    Thank you

Have any comments?