Presents your JAVA E-NEWSLETTER for March 13, 2003 <-------------------------------------------> MAKE MUNDANE DEV TASKS EASIER WITH ANT The cycle of writing, compiling, and running code can become tedious; and the more complex the application, the more tedious it can be. Build tools help you build and deploy your applications. The standard Java build tool is currently Ant. It doesn't take a lot of work to use Ant with Java projects. First, you have to download and install Ant. (Ant is well documented, and the manual will guide you through each step of the installation.) Then create a build file--an XML file that contains Ant targets--for your project. Here is a sample Ant build file: A basic unit of work in Ant is called a target. Each target should represent a separate part of the build process: compile, jar, war, doc, etc. Ant targets can have dependencies. If a target has a dependency, then the dependency will be executed before the specified target that depends on it. Here's a sample target: The identifiers beginning with a dollar sign and enclosed in brackets are Ant properties. See the Ant documentation for an explanation of properties. You can specify a default target in your build file's project element: The default target will be executed if you run Ant with no options, like this: >ant Buildfile: build.xml compile: [javac] Compiling 2 source files to bin jar: [jar] Building jar: javatips.jar BUILD SUCCESSFUL Total time: 1 second You can also specify a target or targets to build when you run Ant. The following command would run the "clean" target. >ant clean Buildfile: build.xml clean: [delete] Deleting: javatips.jar [delete] Deleting 2 files from bin BUILD SUCCESSFUL Total time: 0 seconds With a small amount of effort, you can reduce the complexity of a mundane but sometimes difficult task. The bigger your project, the more you'll benefit from using Ant. Learn more about Ant's other features, including CVS access, FTP, and program execution. http://ant.apache.org/ ----------------------------------------