Browse Source

Clearly (hopefully) document '$'-escaping relating to Ant properties;

increase findability of this information by linking from property task.
PR: 34534


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278384 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
c07b787a9a
2 changed files with 15 additions and 1 deletions
  1. +2
    -1
      docs/manual/CoreTasks/property.html
  2. +13
    -0
      docs/manual/using.html

+ 2
- 1
docs/manual/CoreTasks/property.html View File

@@ -10,7 +10,8 @@


<h2><a name="property">Property</a></h2> <h2><a name="property">Property</a></h2>
<h3>Description</h3> <h3>Description</h3>
<p>Sets a property (by name and value), or set of properties (from file or
<p>Sets a <a href="../using.html#properties">property</a>
(by name and value), or set of properties (from file or
resource) in the project. Properties are case sensitive.</p> resource) in the project. Properties are case sensitive.</p>
Properties are immutable: whoever sets a property first freezes it for the Properties are immutable: whoever sets a property first freezes it for the
rest of the build; they are most definitely not variable. rest of the build; they are most definitely not variable.


+ 13
- 0
docs/manual/using.html View File

@@ -245,6 +245,19 @@ if there is a &quot;builddir&quot; property with the value
&quot;build&quot;, then this could be used in an attribute like this: &quot;build&quot;, then this could be used in an attribute like this:
<code>${builddir}/classes</code>. <code>${builddir}/classes</code>.
This is resolved at run-time as <code>build/classes</code>.</p> This is resolved at run-time as <code>build/classes</code>.</p>
<p>In the event you should need to include this construct literally
(i.e. without property substitutions), simply "escape" the '$' character
by doubling it. To continue the previous example:
<pre> &lt;echo&gt;$${builddir}=${builddir}&lt;/echo&gt;</pre>
will echo this message:
<pre> ${builddir}=build/classes</pre></p>
<p>In order to maintain backward compatibility with older Ant releases,
a single '$' character encountered apart from a property-like construct
(including a matched pair of french braces) will be interpreted literally;
that is, as '$'. The "correct" way to specify this literal character,
however, is by using the escaping mechanism unconditionally, so that "$$"
is obtained by specifying "$$$$". Mixing the two approaches yields
unpredictable results, as "$$$" results in "$$".</p>


<h3><a name="built-in-props">Built-in Properties</a></h3> <h3><a name="built-in-props">Built-in Properties</a></h3>
<p>Ant provides access to all system properties as if they had been <p>Ant provides access to all system properties as if they had been


Loading…
Cancel
Save