ANT Targets and Tasks
by, 11-19-2011 at 05:39 PM (592 Views)
In this post, I will talk about ANT targets and tasks.
Each buildfile contains at least one target within the project. One target can be dependent upon the another target.
Suppose you want to execute target E, which depends upon D, C, B and AJava Code:<target name="A"> <target name="B" depends="A"> <target name="C" depends="B"> <target name="D" depends="C"> <target name="E" depends="D,C,B,A"> </target></target></target></target></target>
D depends on C
C depends on B
B depends on A
First A is executed, then B, then C, then D and in the end E
Targets consists of tasks. It is a piece of code that can be executed. A task can have several attributes. The value of an attribute might contain references to a property. These references will be resolved before the task is executed.
Tasks have a common structure:
where name is the name of the task, attributeN is the attribute name, and valueN is the value for this attribute.Java Code:<name attribute1="value1" attribute2="value2"> </name>
There are built-in tasks as well as optional tasks. You can also write your own tasks.