An Example Project and Buildfile

To provide an example buildfile for this book, we need an example project. We use a project that already exists as a GNU Make-based project called irssibot, an IRC bot[16] written by Matti Dahlbom (the original can be found at This project requires all the features of a typical build: compiling source code, packaging classes, cleaning directories, and deploying the application. As an exercise, we took this project and converted it to use Ant.

Understanding the Project Structure

Let’s begin by looking at how we configure the directories for the irssibot project. Java project organization methods vary — sometimes considerably so — depending on the project (e.g., web applications have very different project structures from GUI tools). Many times, the tools dictate a project’s structure. Some IDE’s, for example VisualAge versions prior to 3.5, require that all source code is in one file. EJB and CORBA compilers require naming conventions for source files and directories. For all cases, the project model should fit the requirements of your revision control system (you use a revision control system, right?). Because of such varied requirements and dependencies, a perfect project organizational pattern does not exist and we do not propose to suggest one here. The layout and organization we describe, however, is simple enough to work with many projects, and it works especially well with Ant.

Designing and implementing ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.