I have this weird behavior with ant
and properties and I'd like to know what do you think. I don't get the logic.
This behavior could be usefull but I would like to know if I can rely on it or if this is a bug.
It looks like ant is applying the prefix when expanding the right hand side of properties if there is no property of the desired name. Here is the SSCCE:
build.properties:
a=A
formula=${a}
build.xml:
<project default="test">
<target name="test">
<property name="test.a" value="[test.a has been used instead of a, why? prefixValues is false]" />
<property file="build.properties" prefix="test" prefixValues="false" />
<echo>${test.formula}</echo>
</target>
</project>
output:
test:
[echo] [test.a has been used instead of a, why? prefixValues is false]
BUILD SUCCESSFUL
Total time: 364 milliseconds
As you can see, test.formula should use "a" and not "test.a" but "a" is never defined. Is it the reason?
I ran some more test and could get a lot of different results.
After checking the sources, I think that there is a bug when looking for properties while adding them through a file. By modifying some ant source code, I could get it to work.
In the end, I decided to fill a bug report (https://issues.apache.org/bugzilla/show_bug.cgi?id=54769) with a proposed patch.
Thank you all.