Catalysoft   Turtle
home products articles about us contact us

What is 'ant'?

Ant is a build utility written in Java and primarily for Java programs. It is often described as "something like make, but without the wrinkles"

The build script is written as an XML document that expresses the dependencies between various subcomponents or tasks (called targets) of a project

For example, the most basic task when building a Java project is compiling the source code. You therefore write a target definition that includes the javac task, which performs the compilation. Then, at the command line, you type ant compile, and the code compiles. Classpath issues are dealt with inside the ant script itself to keep the command line simple and eliminate errors.

The next target you will need is one to execute the program. You cannot execute the program without it first having been compiled, so the execution target depends on the compilation target.

Before long, you find yourself writing targets to clean up directories of compiled code, jar up class files, auto-deploy to particular directories or applications, run unit tests, interact with source-code control systems such as CVS, and so on. There are very many target types supported, and if what you want to do is not already supported, you can always extend ant by writing your own target (its not difficult).

In effect, the ant script becomes a central point of contact between you and any management tasks for your project.

For example, here is a simple "baseline" ant script:

<project name="MyProject" default="dist" basedir=".">
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>

  <path id="main.classpath">
    <pathelement location="${build}"/>
    <pathelement location="other.jar"/>

  <target name="init">
    <!-- Create the time stamp -->
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>

  <target name="compile" depends="init" description="compile the source " >
    <javac srcdir="${src}" destdir="${build}"/>

  <target name="run" depends="compile" description="executes the program">
    <java classname="com.something.MyClass" classpathref="main.classpath" fork="yes"/>


For more information, visit the Apache Ant Project web site at

Other Terms

A9AlgernonAOPArtificial Intelligenceawk
BeanShellCCamel CaseCastorCladonia Exchanger XML Editor
EclipseEditiXErlangExpert SystemExtreme Programming
Firefoxfirst class objectFortranFreeMindGroovy
SwoogleTrojan HorseXML-Java BindingXMLSpy