Friday, December 7, 2012

Apache Ant – Building Simple Java Projects

Ant Tutorial

By using this tutorial you can easily and quickly learn how to use Ant to build  java projects.

Ant Definition

Apache Ant is an open source, cross-platform based build tool that is use XML scripting to build  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. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.

Apache Ant Overview

Ant is developed by Apache Foundation specifically to build projects based on java platform. Ant is an abbreviation forAnother Neat Tool.

A Java build process typically includes:
  • the compilation of the Java source code into Java Bytecode
  • creation of the .jar file for the distribution
  • creation of the Documentation
Ant uses anXMLfile for its configuration. You can’t give any name to this file, this file is usually calledbuild.xmlIt builds are based on three blocks: taskstargets and extension points .
A task is a individual work like compile source code or creating Javadoc. More than one task can be combine to form a group called targets.
A target can be directly invoked via Ant. Targets can specify their dependencies  using “depends” attribute. Ant tool will automatically execute dependent targets.
For example if target Run depends on Compile, than Ant will first perform Compile and then Run.
<target name="compile">
<target name="run" depends="compile">
In yourbuild.xmlfile you can specify the default target. Ant will execute this target, if no explicit target is specified.

History of Ant

The development of Ant technology originated as an integral component of Tomcat application server based on Java Servlet and Java Server Faces. Ant, as a part of Apache Jakarta Project is an open source solution based on java platform.  Ant used as a major tool in building java projects and now it has become a top-level Apache project for server-side solutions. The latest release of Ant is version 1.8.4.
Introduction to Apache Ant (Another Neat Tool)
Ant is an open source build technology developed by Apache intended to build processes in Java environment. Ant is based on XML and uses java classes in automatic generation of build processes that makes it platform independent. It is applicable to any integrated development environment (IDE) that uses java. A build file is generally named asbuild.xml (can’t be other than build.xml).
The best features of the Ant technology can be summarized as below -
  • · Easy to Use: As it is an XML based scripting tool, therefore easy to understand and implement.
  • · Portable and Cross-platform based:  it can be run on any operating system.
  • · Extended Functionality:  It is easier to implement than any specific IDE because it is automated and ubiquitous.
  • · Build Automation: Ant provides automated build processes that is faster and more efficient than manual procedures and other build tools can also be integrated with it.
  • · Compilation of Source Code: Ant can use and compile source code from a variety of version controls and packaging of the compiled code and resources can also be done.
  • · Handling Dependencies between Targets: An Ant Project describes the target and tasks associated with it and also handles dependencies between various targets and tasks.


  1. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    SAP course in chennai|SAP training|SAP Course in Chennai|sap training in Chennai

  2. Everyone wants to get unique place in the IT industry’s for that you need to upgrade your skills, your blog helps me improvise my skill set to get good career, keep sharing your thoughts with us.
    sas training in Chennai|sas course in Chennai|sas training institute in Chennai

  3. Before you pick on a web hosting company you have to make a review of the best web hosting service providers available; you will discover how beneficial they will be to your business and how they will suit your budget. Here is my best web hosting companies:

  4. Gaming is one of the productive activities that ensure the personal developments of individuals for them to impact favorably on the development of their societies. Unfortunately, this creatively designed applications better known as electronic or video games that function on consoles such as X-box and play station on computers, mobile devices, and other electronic gadgets have been negatively branded as evil by some critics. There is the urgent need to offer a convincing reply to these unfair critics who dwell solely on the unkempt disadvantages of gaming to plunge its whole benefits into disrepute. Pest Control Services North Richland Hills TX