1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 8. Unset Task</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch07.html" title="Chapter 7. Try Task"><link rel="next" href="bk03ch09.html" title="Chapter 9. Variable Task"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Unset Task</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch07.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch09.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="Unset"></a>Chapter 8. Unset Task</h2></div></div></div>
|
---|
2 | <STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>
|
---|
3 | <p>
|
---|
4 | The Unset task provides easier access to one of the most used use cases of <a href="bk03ch09.html" title="Chapter 9. Variable Task">Variable</a>, 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.
|
---|
5 | </p><p>
|
---|
6 | To use this task in your build files, include a task definition like this:
|
---|
7 | </p><p>
|
---|
8 | </p><pre class="programlisting">
|
---|
9 |
|
---|
10 | <taskdef name="unset" classname="ise.antelope.tasks.Unset"/>
|
---|
11 |
|
---|
12 | </pre><p>
|
---|
13 | </p><p>
|
---|
14 | </p><div class="table"><a name="id2521084"></a><p class="title"><b>Table 8.1. Unset Task Attributes</b></p><table summary="Unset Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the property to unset.</td><td>None</td><td>Yes, unless 'file' is used.</td></tr><tr><td>file</td><td>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.</td><td>None</td><td>Yes, unless 'name' is used.</td></tr></tbody></table></div><p>
|
---|
15 | </p><p>
|
---|
16 | Example:
|
---|
17 | </p><pre class="programlisting">
|
---|
18 |
|
---|
19 | <project name="unset_example" basedir=".">
|
---|
20 | <taskdef resource="ise/antelope/tasks/antlib.xml"/>
|
---|
21 | <property name="x" value="6"/>
|
---|
22 | <echo>original value = ${x}</echo>
|
---|
23 | <unset name="x"/>
|
---|
24 | <echo>unset: ${x}</echo>
|
---|
25 | <property name="x" value="hello"/>
|
---|
26 | <echo>new value = ${x}</echo>
|
---|
27 | </project>
|
---|
28 |
|
---|
29 | $ ant -f unset_example.xml
|
---|
30 | Buildfile: unset_example.xml
|
---|
31 | [echo] original value = 6
|
---|
32 | [echo] unset: ${x}
|
---|
33 | [echo] new value = hello
|
---|
34 |
|
---|
35 | BUILD SUCCESSFUL
|
---|
36 | Total time: 0 seconds
|
---|
37 |
|
---|
38 | </pre><p>
|
---|
39 | </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Try Task </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 9. Variable Task</td></tr></table></div></body></html>
|
---|