Ant Programming Questions & Answers

Explore model answers categorized by subjects like Java, HTML, DBMS, and more.

Ant Programming Questions & Answers

What is Ant?

Answer:
Ant is an open source code .It is Java-based build tool sponsored by Apache Software Foundation.It is a program for putting all the pieces of a program together.A simple definition might state that \"Ant is a Java-based build tool from Apache Software Foundation\".Ant is kind of like Make.But there is some difference b/w two.Which we discuss later.

What is a build tool?

Answer:
A built tool is software which is used to build project,directory structure,copy necessary files to that directory ,compile files ,create jars,set path and class-path ,Build the documentation ,Validate the source code,deploy,debug,and run,clear the workspace.

How many types of build tool you know?

Answer:
I know two type of build tool which are used to build a java based project.
These are ANT and Make.

What is different between Ant and Make?

Answer:
The most important difference between Ant and Make is that Ant uses XML to describe the build process and its dependencies, whereas Make uses its Makefile format. By default the ant XML file is named build.xml.

What is History of Ant?

Answer:
Ant was created by James Duncan Davidson(author of Tomcat). Initially, It was part of the Tomcat .When it was donated to the Apache Software Foundation. Ant was used to build Tomcat, nothing else.But In January 2000, Ant was moved to a separate CVS module and was promoted to a project of its own, independent of Tomcat, and became Apache Ant.

The first version of Ant was the one that shipped with Tomcat\'s 3.1 release on 19 April 2000. This version was referred  as Ant 0.3.1 later.

Today the latest version of ant is released at 27 June 2008 is Ant1.7.1.

Which version of Java is required to run Ant?

Answer:
The following table lists the minimum Java versions required to compile and run Ant:

Ant Version        Minimum Java Version
1.1  To 1.5.4       1.1
1.6.0 To 1.6.5       1.2
1.7.0 To 1.7.1       1.3
current svn trunk 1.4

Why do you call it Ant?

Answer:
The ant is acronym of \"Another Neat Tool\" according to James Duncan Davidson. Ants are very small and can carry heavy weight.So as Job of Apache ant. Its name is called ANT.

How you can Prepare a project in ANT?

Answer:
We can prepare a project by making a build.xml as a build file and using following tag.Inside this tag we have defined standard targets( such as build,clean etc),etc.

<project name=\"NameOfProject\" basedir=\".\" default=\"main\">
.........
........
</project>

From where we can download Ant latest version?

Answer:
We can download the latest version of ant from the website of Apache ant.The link of website is http://ant.apache.org/bindownload.cgi We need download .zip archive: for window XP/2000/NT etc and  .tar.gz archive: for Linux / Ubuntu /Fedora etc

How we can set the PATH environment variable of ant?

Answer:
Assume Ant is installed in d:ant. The following sets up the environment:

Set environment for Windows and OS/2


set ANT_HOME=d:ant
set JAVA_HOME=d:jdk-1.5.0.05
set PATH=%PATH%;%ANT_HOME%bin

Set environment for Linux/Unix (bash)

Assume Ant is installed in /usr/local/ant. The following sets up the environment:
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/local/jdk-1.5.0.05
export PATH=${PATH}:${ANT_HOME}/bin

Set environment for Linux/Unix (csh)
setenv ANT_HOME /usr/local/ant
setenv JAVA_HOME /usr/local/jdk/jdk-1.5.0.05
set path=( $path $ANT_HOME/bin )

What is advantage of Ant 1.7.1 ?

Answer:
Ant 1.7.1 is mainly a bugfix release.

Ant 1.7.1 has extended support for Java6 features.

Ant 1.7.1