JaVa
   

Ant Parent Elements

There are many parent tags in Ant, which are described in this section.

Project Tag

All targets are nested within a parent tag that defines the Ant project:

<project basedir="[working directory]" default="[default task]" name="[project name]">
 <!--All tasks will be nested within targets here-->
</project>


Parameters

Target Tag

All of Ant’s tasks fit into a parent target element:

<target name="[target name]"/>


All tasks reside within target tags. The parent target tag defines the order of execution by declaring dependences. All dependent tasks will then execute before the task that defined it. This relationship is the primary way to define execution order within Ant files. Alternatively, the antcall and ant tasks can be used to execute tasks by target name. For more information, refer to these tasks under the section “Ant’s Key Tasks” later in this chapter for more detail.

Parameters

Path Tag

The path element allows for paths to be used by many tasks:

<path id=[property] path="[path]"/>


Parameter

Nested Parameters

Filter Tag

Filters can be used for file-copying tasks. All instances of a specified token can be replaced with a specified value. A token is a value that can be automatically expanded in a set of text files when they are copied. Tokens are encased in the @ character as in @filename@. If a token exists in a file but no token is defined in the buildfile then no action will be taken, i.e., the token defined in the file will not be changed. You define a token using the filter tag as follows:

 <filter token="filename" value="autoexec.bat"/>


Later if you copied a text file with that contained the text “@filename@” and filtering is on, the text “@filename@” is replaced with “autoexec.bat”. Demonstrated as follows:

 <copy todir="/tmp" filtering="true">
 <fileset dir="/src/config"/>
 </copy>


Parameters

Tstamp Tag

The tstamp task sets several properties to the current date and time. From the system time:

The tag is as follows:

<tstamp/>


Nested Parameters


JaVa
   
Comments