An ANT Build System

Here is some information about how we use ANT at my workplace. The company I work at was kind enough to let me present this information here as I wanted to try to provide some information back to help other people using these great tools that are, mostly, created and maintained by volunteers. This is just one way to do things; it is tied to my work environment and not meant to be a general "one size fits all" resource, but hopefully a good place for some ideas. Also, it's good to describe it as documentation for the future and to make things clear for myself anyway :)

If you have some feedback of any kind, feel free to post in the Development Automation and Code Quality forums

ANT at a glance - a quick intro to what ANT is
Description of our build system
Using our build system from projects

Common Targets

Common Build Targets - an "API" to the targets

To use any of the common tasks, you need to set some properties at the start of each build file (either in the build file or in an included properties file).
The most common and important ones are:

There are also other properties which may need to be set before calling some targets in the common build scripts, please take a look over the Common Build Targets for a description of what each target available does and what the required properties are.

Remember that, with ANT, when you set a property its value doesn't change. This means that default properties can be set in the common scripts and overridden by the project scripts.

NOTE: the 'java' and 'javadoc' executables must be in your system path environment

3rd Party Tasks

PMD - static code analysis
FindBugs - compiled code analysis
JUnit - junit test runner
Clover - code coverage for junit run tests
JavaNCSS - source code metrics
JDepend - show code dependencies
XMLTask - XML handling

Some Common ANT Tasks

These tasks have been written to provide helpful utilities through ANT (also within WSAD).

ClasspathTask - obtain a simple WSAD projects classpath
ApplyDriveLetterTask - obtains the current drive letter of where the project exists and updates/prefixes the given property value with this
J2EEClasspathTask - obtain the classpath from a WSAD project in a J2EE application. This will also get the output directory of any referenced project as well
JDependHelperTask - help modify GraphViz output to produce a graphical dependency diagram of the components
ListAllJavaFilesTask - produce a listing of all of the Java files in a workspace
NNTPTask - send a message to a news server using NNTP
SerialVerTask - create a serialVersionUID for a class

The Java source files for these tasks can be downloaded here

External Resources

http://ant.apache.org - the home of ANT. This always shows the latest info


DeadEd.com
http://www.deaded.com/staticpages/index.php/anantbuildsystem