The Unset task provides easier access to one of the most used use cases of Variable, the ability to unset a property. By design, Ant properties are immutable, but sometimes it is handy to set a property to a new value.
To use this task in your build files, include a task definition like this:
<taskdef name="unset" classname="ise.antelope.tasks.Unset"/>
Table 8.1. Unset Task Attributes
Attribute | Description | Default | Required |
---|---|---|---|
name | The name of the property to unset. | None | Yes, unless 'file' is used. |
file | The name of a property file. All properties references in the file will be unset. This means you can load a bunch of properties from a file, then unset them all with a single line. | None | Yes, unless 'name' is used. |
Example:
<project name="unset_example" basedir="."> <taskdef resource="ise/antelope/tasks/antlib.xml"/> <property name="x" value="6"/> <echo>original value = ${x}</echo> <unset name="x"/> <echo>unset: ${x}</echo> <property name="x" value="hello"/> <echo>new value = ${x}</echo> </project> $ ant -f unset_example.xml Buildfile: unset_example.xml [echo] original value = 6 [echo] unset: ${x} [echo] new value = hello BUILD SUCCESSFUL Total time: 0 seconds