8th January 2009 - 4 minutes read time
Phing allows you to set up certain parameters that can be used throughout the rest of the script. These might be used to define a non standard build directory, or to store database connection details that can be written to the connection file during the build.
Properties are defined using the property element, which you should place at the top of your build.xml file in order to make it easy for other developers to see what is going on. The following example defines a property and the uses the main target to print the property out.
<?xml version="1.0"?>
<!-- build xml -->
<project name="myProject" default="main">
<property name="property1" value="value1" />
<target name="main">
<echo>property1: ${property1}</echo>
</target>
</project>
Running this build.xml file will product the following result.