H.2 Targets
Prev | Appendix H. Project Components | Next

## H.2 Targets

### H.2.1 Example

    <target if="lang" unless="lang.en" depends="foo1,foo2"
           name="main" description="This is an example target" >

      <!-- everything else goes here -->

    </target>

The target defined in the example above is only executed, if the property `${lang}` is set and the property `${lang.en}` is not set. Additionally, it depends on the targets `foo1` and `foo2`. That means, the targets `foo1` and `foo2` are executed before the target `main` is executed. The name of the target is `main` and it also has a description.

### H.2.2 Attributes

Table H.2: Parameters

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`depends` | `String` | One or more names of targets that have to be executed before this target can be executed. | n/a | No
`description` | `String` | A free text description of the target. | n/a | No
`if` | `String` | The name of the property that is to be set if the target is to be executed. | n/a | No
`name` | `String` | The name of the target | n/a | Yes
`unless` | `String` | The name of the property that is to be set if the target is not to be executed. | n/a | No
`hidden` | `Boolean` | Whether or not to include this target in the list of targets generated by `phing -l` | False | No
`logskipped` | `Boolean` | Whether to log message as INFO instead of VERBOSE if target is skipped | False | No

### Caution

The if and unless attributes only enable or disable the target to which they are attached. They do not control whether or not targets that a conditional target depends upon get executed. In fact, they do not even get evaluated until the target is about to be executed, and all its predecessors have already run.

Prev | Up | Next
Appendix H. Project Components | Home | Appendix I. File Formats