Building Your Struts Applications with Ant
Although there are several different mechanisms to compile and deploy your Struts application, by far the most popular and most flexible is the Ant build tool. This section discusses how to use Ant to perform the necessary tasks for compiling and packaging your application.
What Is Ant?
Ant is a platform-independent build tool that can be configured to compile your Java source code files, build your deployment JAR and WAR files, unit-test your code, and create your project’s JavaDoc documentation. It also has many other uses and can be expanded to perform new tasks of your own creation.
Ant is similar to the Unix make utility (also known as gmake in Linux and nmake in DOS/Windows). make utilities have been used for generations to manage projects for languages such as C and C++, but these utilities are platform-dependent because the rules they use are typically shell commands executed by the host operating system. Unlike make, Ant’s rules (or tasks, in Ant terminology) are Java classes and can be run on any platform with a supported JVM.
Installing and Configuring Ant
You can download Ant from the Jakarta web site at http://ant.apache.org/. The examples provided in this chapter were tested with Ant 1.6. Download the binary zip file (for Windows) or the .tar.gz file (for Unix) and uncompress the archive into your desired installation directory. You should also download the optional.jar file and install it in the ANT_HOME/lib directory. ...