Ant, which is XML based, looks a little like HTML. It has special tags called tasks, which give instructions to the Ant system. These instructions tell Ant how to manage files, compile files, jar files, create Web application archive files, and much more.
Listing 20.1 shows a simple Ant build file with two targets. Ant build scripts have a root element called project. The project element consists of subelements called targets. These elements in turn have task elements. Task elements do useful things, such as creating directories and compiling Java source into Java classes. All of the tasks for a given target are executed when the target is scheduled to execute. The project element has a default attribute, which specifies the target that should be executed for the project. In Listing 20.1, the compile target is the default. However, the compile target has a dependency specified by the depends attribute. The depends attribute can specify a comma-delimited list of dependencies for a target.
<project name="hello" default="compile"> <target name="prepare"><target name="compile" depends="prepare"> <javac srcdir="./src" destdir="/tmp/classes" />
</target>