Is there a way to re-assign the value for the Ant property
task? Or is there another task available for that purpose?
Here is a sample using local with the basename command. Var-unset does not work for me.
<for param="db-patches">
<path>
<fileset dir="${undeployed-files}" includes="**/ddl*.zip"/>
</path>
<sequential>
<local name="inpfile" />
<basename property="inpfile" file="@{db-patches}" suffix=".zip" />
<!-- unzip the patch -->
<unzip src="${undeployed-files}/${inpfile}.zip"
dest="${unzipped-patches}/${inpfile}" />
<move file="${undeployed-files}/${inpfile}.zip" tofile="${deployed-files}/${inpfile}.zip"/>
</sequential> </for>
Depending on how you want to use the modified property, you can use macrodef
s.
For example, instead of writing the following:
<target name="foo">
<echo message="${my_property}"/>
</target>
and not being able to call ant foo
with another message, you could write:
<macrodef name="myecho">
<attribute name="msg"/>
<sequential>
<echo message="@{msg}"/>
</sequential>
</macrodef>
<target name="foo">
<myecho msg="${my_property}"/>
<property name="my_property2" value="..."/>
<myecho msg="${my_property2}"/>
</target>