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 -->


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

dependsStringOne or more names of targets that have to be executed before this target can be executed.n/aNo
descriptionStringA free text description of the target.n/aNo
ifStringThe name of the property that is to be set if the target is to be executed.n/aNo
nameStringThe name of the targetn/aYes
unlessStringThe name of the property that is to be set if the target is not to be executed.n/aNo
hiddenBooleanWhether or not to include this target in the list of targets generated by phing -lFalseNo
logskippedBooleanWhether to log message as INFO instead of VERBOSE if target is skippedFalseNo


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.