Ant buildfiles as project builders
Our second practical example of using Ant buildfiles in Eclipse
is a 'project builder'. This is an Ant buildfile that has been designated to
run whenever a project is built. The uses for such a buildfile are many:
- Generate a
.jar
file containing class files from your project
- Perform some type of pre- or post-build processing on source or binary files
in your project. For example:
- Pre-processing source files to instrument them for performance analysis
- Obfuscating binary files to prevent reverse engineering
- Copy class files to some location (for instance, on a network)
For this example, we will create an Ant buildfile that creates a .jar
archive
of the class files in a project. Note that this is similar to the example in
the last chapter, in which we used an Ant buildfile to generate .jar
files for
an Eclipse plug-in. This example differs in that it works for any Eclipse project,
whether or not it is also an Eclipse plug-in.
Creating Ant buildfiles
Editing Ant buildfiles
Running Ant buildfiles
Saving & Reusing Ant options
Creating a project builder Ant buildfile
Executing project builders
External tools
Non-Ant project builders
Stand-alone external tools