Previous Section
Table of Contents
Next Section


Chapter 3: Ant Tasks

Ant tasks are commands to perform various functions, such as compiling the source code, packaging classes, attaining file versions from Concurrent Versions System (CVS), copying files and directories, compressing files, and changing file permissions.

This chapter describes the built-in, optional, and user-defined tasks of Ant. It also explains how to write tasks, set up the build environment, use the tasks, and test the tasks.

Understanding Ant Tasks

Ant tasks consist of various attributes that specify their functions, such as a unique ID for the task, a task name, and comments. The syntax for an Ant task is:

<taskname atbtype="value1" atbtype="value2"..........>

This syntax consists of the name of the atbtype task, which specifies the attribute type and the corresponding value of the attribute. The value specifies the function of the Ant task. For example, the following command copies the abc.log file to the dir directory:

<copy file = "abc.log" toDir="dir"/>

The features of Ant tasks are:

The three types of Ant tasks are:

Each Ant task contains a set of unique attributes to specify its functioning. A specific set of attributes, such as Id, taskname, and description are common to all Ant tasks. The common attributes of Ant tasks are:



Previous Section
Table of Contents
Next Section