简体   繁体   中英

phing loadfile to property does not override previous value

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM