phing loadfile to property does not override previous value

126 Views Asked by At
<loadfile property="test-from-file" file="value.txt" />
<echo message="test-from-file = ${test-from-file}" />
<loadfile property="test-from-file" file="value2.txt" />
<echo message="test-from-file = ${test-from-file}" />

The second loadfile does not change the value of the test-from-file property.

Is there any way to get this working?

1

There are 1 best solutions below

0
Guibod On

As stated in comments by Jawi, properties are not overridden by design. A property works as a constant in Phing. So if it is already defined, then it won't be changed by later property definitions.

I think that you should revert your <property> task call in order to define your preferred sources first.

Alternatively, you can also use <property override="true"> to alter default behavior and override existing values, changing properties from constant to variable.