CHAPTER 19 ■ AUTOMATED BUILD WITH PHING
Now that I have wrapped up the target element, table 19–2 shows a summary of its attributes.
Table 19–2. The Attributes of the target Element
Attribute Required Description
Name Yes The name of the target
Depends No Targets on which the current depends
If No Execute target only if given property is present
Unless No Execute target only if given property is not present
Description No A short summary of the target’s purpose
When a property is set on the command line, it overrides any and all property declarations within
the build file. There is another condition in which a property value can be overwritten. By default, if a
property is declared twice, the original value will have primacy. You can alter this behavior by setting an
attribute called override in the second property element. Here’s an example:
<?xml version="1.0"?>
<project name="megaquiz"
default="main"
I set a property called dbpass, giving it the initial value "default". In the main target I set the
property once again, adding an override attribute set to "yes" and providing a new value. The new value
is reflected in the output:
$ phing
Buildfile: /home/bob/working/megaquiz/build.xml
megaquiz > main:
[echo] pass: specific
BUILD FINISHED
Total time: 0.3802 seconds