1.4.1. Ant: Building and Deploying Applications
Ant is used to manage the process of building and deploying code, among other things.
Ant is similar in purpose to age-old tools like make, gmake, and imake. It provides a way
to codify the parameters needed to build your code (like dependent libraries, configuration
files, and the like) and to define various tasks that can be done with the code (compile it,
generate Javadoc pages from it, assemble it into a J2EE application archive, deploy it to
an application server, and run unit tests on it, among other things).
Ant is an open source project managed by the Apache Software Foundation. It "ships" with
a large set of core tasks that can be used to compose Ant "build scripts," which are written
in XML. An Ant build script consists of a set of targets that you define. Each target consists
of a set of tasks that are executed when that target is requested by the user or invoked by
another target. These tasks can be core tasks included with Ant (like "compile this set of
Java code" or "copy these files to that directory"), they can be custom tasks that you define,
or they can be tasks that are imported from a third-party library. Many J2EE application
servers and tools (including many of the open source tools discussed in this book) now
include their own Ant tasks, to allow you to easily integrate them into your project Ant
Many Ant tasks and practices have been defined to help develop and manage large
enterprise projects in the Java environment. Chapter 17 provides both an overview tutorial
of Ant in general and some details on Ant-related utilities that are particularly useful when
developing J2EE applications. The chapter also includes some best practices in terms of
designing Ant build processes for multiple developers and multiple environments.