Ant is an extensible build utility from Apache Software Foundation that uses an XML-based syntax for creating build scripts. The build utility is open source and is available for download from the Apache Website at http://ant.apache.org.
Ant almost needs no introduction, as it has become the de facto standard for Java builds. As discussed in earlier chapters, XDoclet, Middlegen, and AndroMDA all rely on Ant for execution.
Chapter 7 discusses Middlegen and Chapter 8 introduces AndroMDA.
Ant's success is due to a number of features that see the build tool ideally suited to Java development. Ant's use of XML documents for defining build files offers a clean and readily understandable syntax, making it possible for developers to get quickly up to speed with the tool. This was a significant problem with earlier Make tools whose declarative semantics were often difficult to grasp.
Furthermore, Ant is implemented in Java and runs under any compliant JVM. This makes Ant a crossplatform build utility, an important factor when working with the J2SE platform. This is also a big advantage over previous Make tools, which rely on platform-specific shell commands for performing build operations.
Due to its huge uptake, Ant has grown into a mature build tool that offers an extensive range of features for performing just about every conceivable build task. Under Ant, build files invoke build operations by calling Ant tasks.
Ant provides a set of core inbuilt tasks that perform many of the common build operations, including:
Where Ant does not support a specific build operation, developers can implement their own custom Ant tasks, which are then accessible from within the build file.
Most major Java software vendors supply Ant tasks for controlling the build process when using their software. The code generators of XDoclet, Middlegen, and AndroMDA all supply Ant tasks specifically for this purpose.
With Ant's ubiquity in the Java world, you will likely use Ant for controlling all of your builds. Consequently, the next sections focus on the use of Ant for designing and implementing optimal build solutions.