O'Reilly logo

Mac OS X for Java Geeks by Will Iverson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Jakarta Ant

As you work with Java, you’ll often encounter references to Ant, an open source tool for managing build processes and other tasks. Ant is a great companion tool to IDEs and text editors, as it can manage complex build tasks, compilation, and even those nasty classpath issues discussed earlier. This section will describe Ant in some detail.

Ant is part of Apache’s Jakarta project. Originally created to provide a cross-platform, portable replacement for the Unix make command, it has become a powerful development, deployment, and installation tool. To use Ant, run scripts from the command line, passing in an XML build file. Inside the build file, you can define variables and tasks to be performed at build time.

Installation and Setup

You can download Ant from http://ant.apache.org/. The latest version as of this writing is 1.5.1, and you can select a ZIP file or a gzipped version. I downloaded jakarta-ant-1.5.1-bin.tar.gz. Expand the file to jakarta-ant-1.5.1 and copy the resultant directory somewhere easily accessible (I used ~/dev for a user-specific installation). Then put the bin subdirectory in your path:

[Wills-Laptop:~] wiverson% setenv PATH ~/dev/jakarta-ant-1.5.1/bin:$PATH

To run Ant, use the ant script (ant.bat on Windows, and just plain ant on Unix-based systems such as Mac OS X):

[Wills-Laptop:~] wiverson% ant
Buildfile: build.xml does not exist!
Build failed

As the message here indicates, Ant expects a build file, generally called build.xml, to give it instructions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required