Normally properties in ant are immutable once set.
With Ant addon Flaka you may change or overwrite exisiting properties - even userproperties (those properties set via commandline -Dkey=value), i.e. create a macrodef and use it like that :
<project name="demo" xmlns:fl="antlib:it.haefelinger.flaka">
<property name="foo" value="bar"/>
<macrodef name="createproperty">
<attribute name="outproperty"/>
<attribute name="input"/>
<sequential>
<fl:let> @{outproperty} ::= '@{input}'</fl:let>
</sequential>
</macrodef>
<!-- create new property -->
<createproperty input="${foo}bar" outproperty="fooo"/>
<echo>$${fooo} => ${fooo}</echo>
<echo>1. $${foo} => ${foo}</echo>
<!-- overwrite existing property -->
<createproperty input="foo${foo}" outproperty="foo"/>
<echo>2. $${foo} => ${foo}</echo>
</project>
output
[echo] ${fooo} => barbar
[echo] 1. ${foo} => bar
[echo] 2. ${foo} => foobar
alternatively you may use some scripting language (Groovy, Javascript, JRuby..) and use ant api :
project.setProperty(String name, String value)
to overwrite a property.