Configuration Management with Ant

Duration: 2 days
Type: intermediate


This is a two day course designed to enable Java developers to create and configure an automated build environment using Ant.

In the first part of the course delegates learn how to automate the building and testing of Java and JEE applications. In the second part delegates learn how to extend and customize Ant itself.


Delegates attending this workshop should be competent Java programmers who are familiar with XML and understand the JEE Architecture and component types.

List of Modules

Revision of Java Deployment and Testing

Creating JAR files with jar.exe
Viewing and editing manifest files
Deploying an application in a JAR file
The structure of a JEE Web Module
Deploying Web Applications in WAR files
The structure of a JEE EJB Module
Deploying Enterprise Applications
Unit Testing Java code using JUnit and TestNG
Tools for integration testing JEE applications

An Overview of Ant

Why Ant was developed
Ant and the Ant-Contrib project
Advantages of Ant over MAKE
Installing and configuring Ant
Running Ant from the command line
Running Ant from inside Eclipse
How NetBeans integrates Ant
How Ant relates to NAnt and MSBuild
Comparing Ant to Maven
Comparing Ant to Raven

Understanding Ant Buildfiles

Examining a simple buildfile
Creating and running targets
Setting the default target
Dependencies between targets
Creating and using properties
Filesets, Patternsets and Selectors
Built-in, optional and third party tasks

Building Basic Java Applications

Specifying paths and sets of files
Specifying one or more classpaths
Navigating the file system and moving files
Calling executables with apply and exec
Extracting source code from version control systems
Compiling code with the javac task
Running Java applications with java
Creating archives using the jar task

Building JEE Applications

Creating Web and Enterprise archives from scratch
Building Web Archives with the war task
Building Enterprise Archives with the ear task
Bulding Web Services via tasks supplied with the JAX-WS RI

Testing Java/JEE Applications

Running JUnit and TestNG unit tests
Converting test results to HTML
Customizing the conversion process
Testing JEE components and Web Services
Generating and presenting test metrics

Managing Multiple Projects

Creating modular buildfiles
Handling conditional behaviour
Specifying shared properties
Importing tasks from other buildfiles
Using antcall to trigger tasks
Using ant to call tasks in other buildfiles
The subant, antcallback and antfetch tasks

Customizing and Extending Ant

An overview of the Ant API
Understanding how Ant is implemented
Writing listeners and loggers
Writing your own Ant tasks
Testing tasks with AntUnit
Writing tasks via scripting languages