Java Reference
In-Depth Information
Looking at the compile section (the
<target>
element with
name="compile"
),
notice that it depends on the
init
directive. Before Ant can execute the compile
commands, it must first execute the dependencies in the
init
target section.
The
init
section is at the beginning of the
XML
file, and the first thing it
directs is a timestamp to be generated. The timestamp will keep track of files
that are out of date and will help Ant synchronize them during the compile
stage. The
init
section also creates a build directory for all the compiled classes
and prevents clutter in the source directories by keeping out class files.
After Ant completes the
init
target section, it can continue processing the
compile section. It calls the
javac
compiler against the source files from the src
directory. The class files are placed in the directory specified by the
build
prop-
erty. Both
src
and
build
property values are defined near the top of the
XML
file
using the
<property>
element.
B.2.2
Cleaning
The
clean
target section simply deletes the directory defined by the
build
property.
Use the following command from the prompt to clean up your build environment:
ant clean