Institute for Advanced Professional Studies

Building Java Projects using ANT

Course Overview:

Ant has now become the de-facto standard tool for building Java applications cross-platform. This course begins with an introduction to what Ant is and what makes it so useful for Java software development projects. We then discuss the structure of a build file and the basic Ant tasks.

The course places an emphasis on the advanced features of Ant that help in writing extensible and maintainable build files. The properties that allow parameterization, portability, and reusability of the build files are examined. The course goes on to explain the datatypes that allow reusing datatype definitions among several build steps. We show how Ant interoperates with the JUnit framework and helps automate the unit testing. The course provides numerous examples and exercises to underpin the working of Ant.

Topic Outline:

  • Ant Introduction
    • What is Ant?
    • Platform-independent Ant
    • Ant vs. make
    • Installing ANT
    • Setting up the environment path
    • build.xml: Project workflow in XML
    • A proposed directory structure
    • Why a directory structure is required?
  • Ant Basics
    • Structure of an Ant build file
    • Writing the build file
    • Invoking the build file
    • Targets and tasks
    • Ant's built-in and third-party tasks
    • Basic Ant tasks: mkdir, delete, echo, javac, jar, java
    • Invoking the targets
    • Target dependencies
    • Dependency resolution
  • Advanced Ant
    • Parameterizing Ant: Properties
    • Using the file
    • Property referencing another property
    • Ant's built-in properties
    • Ant data types
    • FileSets, DirSets, and PatternSets
    • Paths and Classpaths
    • Invoking Ant without an explicit classpath
    • Running the JAR file
    • Creating the JAR Manifest
    • Automatic generation of a build number
    • Build number in JAR Manifest
    • Creating Javadoc documentation
  • Quick Overview of Other Ant Tasks
    • antcall task
    • ant task
    • copy task
    • condition task
    • fail task
    • available task
    • Deploying onto an application server
    • Defining an all target
    • Tips: Writing your build file
  • Ant and Testing Tools
    • Core vs. optional tasks
    • Automate unit testing with JUnit
    • JUnit task
    • Writing JUnit test cases
    • Compiling and running the test cases
    • JUnitReport task: Generating test reports

Course Duration:

1 day

Intended Audience:

This course is for software developers working on Java projects.

Technical Prerequisites:

A basic knowledge of XML and Java is expected.


  • PowerPoint slides
  • On-line exercises and solutions

© Copyright 2007-2015 Institute for Advanced Professional Studies (IAPS)