Common Types and Attributes
All Ant tasks are written using XML — for instance:
<copy file="logo.gif" todir="${builddir}"/>
In this example, file
and todir
are attributes. The attribute values, "logo.gif"
and "${builddir}"
, have specific data types. This
section summarizes the allowable data types for task attributes,
followed by a list of attributes common to all tasks.
XML Attribute Conventions
There are many XML attribute listings in this chapter. They take the following form:
- attribute_name (version, type, required_flag)
Is a description of the attribute and its function.
In which:
- attribute_name
Is the name of the attribute. Use this to refer to the attribute when you specify it for a task.
- version
Indicates the version of Ant supporting this attribute.
all
means Ant Versions 1.2 and later.- type
Indicates the type of data that an attribute can hold. For example,
String
indicates that an attribute holds textual data. See Table 7-2.- required_flag
Indicates whether a given attribute is required when using the task. If this flag is an asterisk (*), then see the notes immediately following the list.
- Description of attribute
Is a description of the attribute and its function.
Table 7-2 summarizes the attribute types frequently referenced throughout this chapter. In all cases, text from XML attributes is converted into one of the basic types listed here. The “Description” column describes how each conversion happens. The “Implemented by” column lists the Java class that Ant uses to represent each ...
Get Ant: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.