Recently I had a defect report that the default value of a configurable parameter was nonsensical to the user, something like "${env.TEST_HOME}".
Of course, this is not nonsensical at all to someone familiar with Ant, though bit embarassing as it reveals an implementation detail: An Ant script is responsible for assigning the default value, taking the value from an environment varaible. When this varaible is not set then the default is set to the string "${env.TEST_HOME}".
So, how to fix this?
To add some checking and conditional processing, I changed the original fragment
<property environment="env"/>
<property="test.home" value="${env.TEST_HOME}"/>
to
<property environment="env" />
<property name="test.home.0" value="${env.TEST_HOME}"/>
<condition property="test.home" value="TO_BE_REPLACED">
<equals arg1="${test.home.0}" arg2="\${env.TEST_HOME}"/>
</condition>
<property name="test.home" value="${env.TEST_HOME}"/>
And though it worked, I didn't like the verbosity of this. So, I asked around for a better alternative. Not surprisingly, I got one from Antoine Levy-Lambert:
<property environment="env"/>
<property name="env.TEST_HOME" value="TO_BE_REPLACED"/>
Much more concise and elegant than my version!