|
|
Building a Java application with Ant
An Ant build scripts is an XML document, typically named build.xml. This XML build
script contains a single project that represents your application and a set of
one or more targets that Ant will perform. A target may tell Ant to compile
your source code or build a JAR file. Common build targets are shown in table
1.
Table 1. Common Build Targets
|
Target
|
Description
|
|
init
|
Initializes the build environment
|
|
compile
|
Compiles source code
|
|
dist
|
Create distribution files such as JAR and WAR files
|
|
clean
|
Clean up the build environment by deleting all compiled source code and
distribution files
|
|
test (or tests)
|
Execute unit tests
|
Targets are hierarchical in the sense that one target can depend on the
successful completion of other targets. For example, the "dist" target
probably depends on the "compile" target, which in turn depends on the "init"
target. After all, you really want your source code compiled before you build
a JAR file that contains it.
|