Build Automation Series: Part 1 – Automated and Repeatable

As part of this series I am going to look at creating an automated build for java projects using the various technologies out there. All code examples will be checked into source control on google code at

What makes a good build?

A goog build is automated and repeatable

A build should be automated to remove any possibility of human error during the build process. It should also be repeatable as we need to be sure that we will get the same results.

To start we will use a apache’s ant build tool to build our simple Java project.

Simple Java Project Structure

We have a simple java project checked out with the following structure:


we create the following ant build.xml file that allows us to clean and compile any source or test code.

The above build file allows to to compile our java source and test files in an automated and repeatable way. The clean target will consistently return the project back to the state that is identical to what it was before the build.

Qualities of a Good Build

So far we are saying that a good build is:

  1. Automated and Repeatable
    1. IDE Agnostic – build is performed by some build tool (like ant) and is not tied to any specific IDE (like Eclipse or intelliJ)
    2. Clean – this target returns the state of the project to what it was when checked out from source control
    3. Compile – this target is responsible for compiling all source code of the project in a consistent way.

Coming up:

One of the basic things we need to do when developing is to create Java test’s as well as Java source. To do this we typically will use some thrid party dependencies to aid this such as Junit, TestNG, Mockito, JMock, EasyMock etc

We will look into handling this using a dependency manager like Ivy in the next part of the series.

View the code

You can browse the code for this post online at

The code can be checked out from svn following the instructions here

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: