Magazine
 
ANT

Initially, it was not an easy task to work on the large java projects but thanks to ant for simplifying the complex details apart from the development concepts that the software developers have to keep in regard while developing the java software.

To understand more clearly, Let’s view a project development scenario without the ant tool where you need to work on a large Java project without any project-building tool. This project consist of multiple java files, classes depending on other classes, stubs or drivers classes situated in multiple directories, additionally the output files are required to save to different locations. If you are
coordinating all of this manually then so many of the development hours are spent in changing directories compiling individual files and so on. This consumes a lot of time and increases the development stress and hassle. However, if you have gone for any projectbuilding tool like ant then you would have saved a lot of development time and reduced the stress to a great extent. 

Ant (originally an acronym for Another Neat Tool), is a build tool with special support for the Java programming language but can be used for just about everything. Ant is platform-independent like java. Ant is particularly good at automating complicated repetitive tasks and thus is well suited for automating standardized build processes. Ant
accepts an instruction in the form of XML documents thus is extensible and easy to maintain.

Apache Ant is a software tool, which is similar to “make” but is written in the Java language, requires the Java platform, and is best suited to building Java projects. Noticeable difference between Ant and make is that Ant uses XML to describe the build process and its dependencies, whereas make has its Makefile format. In ant, the XML file is always named as the build.xml.

Ant is an Apache project. It is open source software and is released under the Apache Software License. Ant allows the developer to automate the

 

repeated process involved in the development of JEE application. Developers can easily write the script to automate the build process like compilation, archiving and deployment. Getting Hands-On Ant For this article I am using jdk1.6.0 and Application Server JBoss 3.2.3 to deploy and test JEE application.

Downloading and Installing Ant

  • Before installing Ant make sure you
    have JDK1.3 or above installed on your
    machine.
  • Download ant from
    http://jakarta.apache.org/ant/ and
    unzip the file into your favorite directory.
  • Set the class path to the bin directory of
    the ant.

Let’s assume that Ant has been installed in c:\ant. Put the following code in the autoexec.bat file:

set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk1.6
set PATH=%PATH%;%ANT_HOME%\bin

Let’s Test The Ant

Go to command prompt and issue the following command.

C:\javajazzup>Ant Buildfile: build.xml does not exist!Build failed
C:\ javajazzup>

If every thing has been installed properly then the Ant will give the message as shown above.

Now its time to do some work with Ant. Ant always uses the default configuration file called build.xml to work. This is the file where you define the process of compiling, building and deploying the application. Writing build.xml filebuild.xml is a xml file used by ant utility to compile, build and deploy the application.


Dec 2007 | Java Jazz Up | 35
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 ,

Download PDF