Making Java out of Anthill

216

Author: Eddie Tejeda

Build managers allow developers to better coordinate their coding efforts by providing an automatically generated current and working snapshot of an application, including a binary file for immediate testing. Build managers are the next logical step to source code repositories. Urbancode‘s Anthill build management server for Java applications provides build automation, unit tests, build tracking, and support for a number of version control systems.

Anthill works by checking out the latest version of the code from the source repository, building it, and automatically tagging the software with a version number. It also publishes the build status to a Web site. All this provides an easy framework to manage development releases and for packaging official releases.

Installing Anthill is a breeze. Naturally, Anthill is written in Java, and requires a working installation of Tomcat. You’ll also need to know how to install Web Archive (WAR) files under Tomcat.

Download the package from the Anthill Web site and extract the contents. To install Anthill, move the extracted directory to /usr/local — or any directory you want — and deploy it by moving anthill-x.x.x/lib/anthill.war to $TOMCAT_HOME/webapps.

If you’re using a version before Tomcat 5 you might need to restart Tomcat. You’ll be be then able to access Anthill from your browser by pointing it at http://hostname:8080/anthill.

When Anthill loads in your browser, it should ask you for the full path of your Anthill installation. Type /usr/local/anthill-x.x.x, where x.x.x is the version number of Anthill you’re working with. If the path is correct, you’ll see the Anthill Build Management Server page.

The first thing you will probably want to do is click Anthill Properties and change the mail host information. The application uses email to notify developers of the build status.

Setting up a project

Open source vs. pro

UrbanCode offers two versions of Anthill: Anthill OS and Anthill Pro. Anthill OS is released under the Urbancode Public License, which is a Mozilla-like license. Anthill Pro is a proprietary project, with a license fee of $2,499 that includes one year of upgrades and 30 days of support.

The professional version provides a better interface, and has advanced features not found in Anthill OS, such as support for multiple versions of Ant, ability to run multiple Java Development Kits (JDK), user authentication, event-based scheduling, and the ability to rebuild older versions of a project.

However, I’ve used Anthill OS on a large open source project (OpenClinica), and found that it works well enough for most projects — even large ones.

On the Anthill Build Management Server page you’ll see a list of example projects, which can help you get the hang of the application. Make sure nothing crashes while you’re clicking around, and get accustomed to the horrible interface. This is one of the drawbacks of the open source version of Anthill — its interface is clunkier than the professional version.

Once you’re done looking through the examples, you might want to delete them and start fresh. Before you do, you’ll need to delete the dependencies located in the third table, called Dependency Groups. You’ll then be able to delete individual projects. I’ll cover dependencies shortly.

To begin a new project, click on the Create New Project link. You will see a long form and a very unintuitive interface to configure the project. Give your project a name in the first input field, called anthill.project.name.

Click the link Configure com.urbancode.anthill.adapter.UrbanCodeVersionAdapter and enter a filename to keep track of your versions. Most open source projects call this file VERSION. Make sure that this file exists in the base directory of your source code.

Repository Driver Name
CVS CVSRepositoryAdapter
FileSystem FileSystemRepositoryAdapter
MKSIntegrity MKSIntegrityRepositoryAdapter
PVCS PVCSRepositoryAdapter
Perforce PerforceRepositoryAdapter
StarTeam StarTeamRepositoryAdapter
Subversion SubversionRepositoryAdapter
VSS VSSRepositoryAdapter

If you’re not using CVS as your source code repository, you must change the value of anthill.repository.adapter. Here is a chart of the possible driver names for each repository type.

After you change your source code repository driver you’ll need to click Configure com.urbancode.anthill.adapter.CVSRepositoryAdapter and configure your repository. You’ll need to have this information at hand in order for Anthill to properly check out the source code.

Next, input the filename and path to your Ant build file in the field called anthill.build.script. Remember, this path is relative to the root directory of the project, not the entire file system.

That’s pretty much all the steps required to set up a project, but Anthill OS has a few more fields that you might want to configure. If you want to be notified of your build status on every attempt, you can enter as many email addresses as you want in the input section called anthill.users. You’ll need to enter them individually, and submit the form every time. The last useful option is called anthill.schedule, at the bottom of the project’s page. You might want to change this value to stoppedSchedule so that you can be sure that your application does not build while you’re setting it up. When you’re ready to start building your application you’ll need to come back to this form and update this field to schedule builds.

Scheduling and dependencies

Label Minutes
Hourly 60
Daily 1,440
Weekly 10,080

Anthill’s Schedules give you the flexibility to build your application as often, or as infrequently, as you want. To edit the scheduler, click Create New Schedule on the main page, label your time frame, and define the build interval in minutes. It’s best to create at least the following schedules:

These schedules will appear throughout Anthill when you’re presented with the option to schedule tasks.

If you are working on multiple projects concurrently, and they depend on each other to build, you can group them together by clicking Create New Dependency Group on the main page. Anthill then gives you the option to label your group, and the ability to add other Anthill projects to the group.

Here the interface fails pretty badly, as you’ll need to add project dependencies one by one, each time being sent back to the main page, instead of being able to add all projects at once.

To add a project to a specific dependency, you select it from the New Member option menu. Then you can define how the projects are related to each other by selecting the option menu called Add Dependency under each project. This allows you to set up projects in order, so that one doesn’t start building before its dependency is finished.

When adding multiple dependencies, you’ll first need to add a project to the dependency group, and then you can assign that project to another project and create dependency links.

You can assign the entire group a schedule to build on. This means that all the projects will be built individually and linked together, so make sure you select a schedule plan that gives the projects time to build.

Building a project

Once Anthill is set up, administration is very easy. The interface shows the build status on the right right of the project name, with the build date colored red or green to indicate build status.

To get more information on a project’s build status, click on the project name. You’ll get a history of its build status, including CVS messages, which should help in tracking down problems if the build breaks.

You can also build an application manually by clicking the Build link next to the project. Although Anthill keeps track of your version numbers, you can force any version number on a build. This comes in handy for making release builds. The OS version only allows you to build the latest version of a project, so if you expect to need to rebuild older versions for some reason, use Anthill Pro. In most cases simply building the latest version is enough, and keeping the archive of the build will allow you to redeploy older versions.

Anthill OS is a great tool, and once it is set up properly it can easily become the backbone of any Java development team. With the proper Ant script you can not only keep your builds current, you can automate tasks such as running JUnit tests, generating documentation, generating release notes, creating JavaDoc documentation, and deploying live demos of your application.

Category:

  • Java