This chapter is an introduction to the fundamental concepts and techniques involved in using Ant to achieve continuous integration on your projects.
Ant
is a build tool that enables you to automate the build process. In that respect, Ant is similar to the make tool; but unlike make, Ant was designed
|
|
Ant was developed by The Apache Software Foundation as part of their Jakarta project. Ant 1.6.1 is distributed with The Apache Software License, Version 2.0 and can be downloaded at:
http://ant.apache.org/bindownload.cgi
|
|
A major advantage of Ant is its extensibility. Ant is easily extensible using cross-platform Java classes. You can also extend Ant by writing custom Java tasks and using the scripting task, which works with JavaScript (Rhino), Python, NetRexx, and others. In addition, if you must, you can call out to shell scripts, OS executables, and OS commands with the Ant
The build-and-deploy cycle should be automated so you don't
|
|
Ant complements Integrated Development Environments (IDEs); Ant does not replace IDEs, nor do IDEs replace Ant. IDEs can greatly simplify Java development, but they are not good for automating the build-and-deploy process of a complex project. Every software process needs a repeatable build system, and IDEs do not provide such a system.
Developers become attached to the IDE they use. At our company, we use several different IDEs, including Eclipse, Borland JBuilder, NetBeans, Forte CE, Visual Age for Java, JDE (Java development environment for Emacs), and Ultra Edit. Ant
|
|
You can use Ant for the organization of deployment and for automated builds. Ant supports the concept of
continuous integration
, as described in the
Developers often talk about automated building and testing but seldom implement it. Ant makes automated building and testing possible and plausible. Ant and JUnit combine well to allow
Alternatives to Ant exist. However, Ant has become the de facto standard for automating Java builds. For example, Sun's pet store J2EE blueprint application uses Ant. The other day, we went to the Orion application server site to look at some examples, and all of them had corresponding Ant buildfiles. Of course, many of the projects at Apache's Jakarta have Ant
The next section will cover the mechanics of using Ant to create buildfiles.