Chapter 7. Core Tasks

This chapter lists core tasks and attributes from Ant Versions 1.2, 1.3, 1.4, and 1.4.1. Whenever the word “all” appears in reference to a version, it means that all of these versions of Ant support a given feature. Ant 1.1 is not considered; tasks and attributes that work only in Ant 1.1 are not described in this chapter.

This chapter is comprised of the following major sections:

Task Summary

Provides a quick summary of Ant tasks

Common Types and Attributes

Describes attribute types, followed by a list of attributes used by all Ant tasks

Project and Target

Describes the syntax of the <project> and <target> elements

Core Task Reference

Describes each of the core Ant tasks

Each task description includes the following information:

  • A brief summary of the task

  • A list of Ant versions supporting the task

  • The name of the Java class implementing the task

  • A list of XML attributes for the task

  • A description of the allowable content, which is either nested XML elements or text

  • Example usage

Task Summary

Table 7-1 summarizes all of Ant’s core tasks. The remainder of this chapter describes each task in detail.

Table 7-1. Core task summary

Task name

Ant versions

Synopsis

ant

all

Invokes Ant on another buildfile.

antcall

all

Calls a target in the current buildfile.

antstructure

all

Creates an XML Document Type Definition (DTD) for Ant buildfiles.

apply

1.3, 1.4

Executes a system command on a set of files.

available

all

Sets a property if a resource is available.

chmod

Get Ant: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.