So ... I have build.xml that loads property file from basedir.
Then, as the target I perform the following:
<var name="Var1" value="<property_from_**first**_loaded_property_file>" />
<var name="<property_from_**first**_loaded_property_file>" unset="true"/>
<property file="../<other directory>/<**second**_property_file>.properties" />
<var name="Var2" value="<property_from_**second**_loaded_property_file>"/>
The ceavat here is that both has same property name. It cannot be changed.
So, in the end, I should get the property like:
Var1=<property_from_**first**_loaded_property_file>
Var2=<property_from_**second**_loaded_property_file>
But instead - I am getting signs that property (Var1) from first properties file is not unset and then filled with new value from second properties file. The thing that ant-contribs unset should deal with :/ ... something like:
Var1 = Var2
Why I am not getting the expected result?
I think the issue is that even though you're loading the variable into an antcontrib
var
, it's still an antproperty
first, thus immutable.I know you can't change the property files, but what kind of freedom do you have with the script itself? You can try to leverage the scoping rules and the
antcallback
task to scope where the variables get loaded.For example, the following achieves - albeit somewhat messily - what I think you're after:
In my console I see:
Which matches the values i set in prop1.properties and prop2.properties, respectively, for the var property.