B.34 PropertyTask

With PropertyTask, you can define user properties in your build file.

Table B.34: Attributes

nameStringThe name of the Property.n/aYes (unless using file or environment)
valueStringThe value of the Property.n/aYes (unless using file or environment)
environmentStringLoads properties from the environment with the specified value as prefix. Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".n/aNo
fileStringPath to properties file.n/aNo
overrideBooleanWhether to force override of existing value.falseNo
prefixStringUsed when properites are loaded from file. Prefix is applied to properties loaded from specified file. A "." is appended to the prefix if not specified.n/aNo
refidStringA reference to a previously defined propeprtyn/aNo
fallbackStringIf a reference cannot be found within the current project scope this attribute specifies a fallback project scope.n/aNo
logoutputBooleanWhether to log returned output as MSG_INFO instead of MSG_VERBOSE.trueNo


Important note about scope: when the <property> tag is called inside a <phingcall> tag, any properties are set in a new local scope. Thus, any properties or other variables set inside that scope will cease to exist (or revert to their previous value) once the parent <phingcall> tag completes.

B.34.1 Examples

<property name="strings.test" value="Harr harr, more power!" />
<echo message="${strings.test}" />

<property name="foo.bar" value="Yet another property..." />
<echo message="${foo.bar}" />

<property file="build.properties" />

<property environment="env" />

<property name="newproperty" value="Hello">
      <regexp pattern="Hello" replace="World" ignoreCase="true"/>

B.34.2 Supported Nested Tags: