110
Apache Ant Targets
A target is a collection of one or more tasks. Task is a piece of code and that is to be executed. A buildfile contains a project and inside the project all the targets are declared. To create a target, we can use <target> tag.
A target can depend on the other target and dependent target must execute before the current target. For example we might have a target for compiling and other one for run the code. Now, we can run target only after the compile target is executed. So the run target is depend on compile target. See an example.
Call-Graph: compile → run
Call graph represents the sequence of target execution.
Note: Each target executes only once, even when it has multiple dependent targets.
The target has various attributes that are given below.
Attribute | Description | Required |
---|---|---|
name | It sets name of the target | Yes |
depends | list of targets on which it is depend. | No |
if | A property that evaluates to true | No |
unless | A property that evaluates to false | No |
description | A short description of this target?s function | No |
extensionOf | Adds the current target to the dependent list of extension point. | No |
onMissingExtensionPoint | What to do if this target extends a missing extension point | No |
The name attribute can be any valid alphanumeric string.
Next TopicApache Ant Tasks