@@ -239,6 +239,69 @@ that don't match the <code>from</code> pattern will be ignored.</p>
<td valign="top"><code>Qlasses/dir/dir2/A.property</code></td>
</tr>
</table>
<p>
The globmapper mapper can take the following extra attributes.
</p>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">casesensitice</td>
<td valign="top">
If this is false, the mapper will ignore case when matching the glob pattern.
This attribute can be true or false, the default is true.
<em>Since ant 1.6.3.</em>
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">handledirchar</td>
<td valign="top">
If this is specified, the mapper will ignore the difference between the normal
directory separator characters - \ and /.
This attribute can be true or false, the default is false.
This attribute is useful for cross-platform build files.
<em>Since ant 1.6.3.</em>
<td align="center" valign="top">No</td>
</tr>
</table>
<p>
An example:
</p>
<pre>
<pathconvert property="x" targetos="unix">
<path path="Aj.Java"/>
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="a*.java" to="*.java.bak" casesensitive="no"/>
</chainedmapper>
</mapper>
</pathconvert>
<echo>x is ${x}</echo>
</pre>
<p>
will output "x is j.java.bak".
</p>
<p>
and
</p>
<pre>
<pathconvert property="x" targetos="unix">
<path path="d/e/f/j.java"/>
<mapper>
<globmapper from="${basedir}\d/e\*" to="*" ignoredirchar="yes"/>
</mapper>
</pathconvert>
<echo>x is ${x}</echo>
</pre>
<p>
will output "x is f/j.java".
</p>
<h4><a name="regexp-mapper">regexp</a></h4>
<p>Both <code>to</code> and <code>from</code> define regular
expressions. If the source file name matches the <code>from</code>
@@ -254,7 +317,7 @@ another dollar-sign in Ant.</p>
<p>The regexp mapper needs a supporting library and an implementation
of <code>org.apache.tools.ant.util.regexp.RegexpMatcher</code> that
hides the specifics of the library. Ant comes with implementations for
<a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html" target="_top">the java.util.regex package of JDK 1.4</a>,
<a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html" target="_top">the java.util.regex package of JDK 1.4 or higher </a>,
<a href="http://jakarta.apache.org/regexp/" target="_top">jakarta-regexp</a> and <a
href="http://jakarta.apache.org/oro/" target="_top">jakarta-ORO</a>. If you compile
from sources and plan to use one of them, make sure the libraries are
@@ -263,13 +326,16 @@ href="http://www.cacas.org/~wes/java/" target="_top">gnu.regexp</a> or <a
href="http://www.crocodile.org/~sts/Rex/" target="_top">gnu.rex</a> with Ant, see <a
href="http://marc.theaimsgroup.com/?l=ant-dev&m=97550753813481&w=2" target="_top">this</a>
article.</p>
<p>This means, you need <code>optional.jar</code> from the Ant release
you are using <strong>and</strong> one of the supported regular
expression libraries. Make sure, both will be loaded from the same
<p>This means, you need one of the supported regular expression
libraries <strong>and</strong>
the corresponding <code>ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp}.jar</code>
from the Ant release you are using.
Make sure, both will be loaded from the same
classpath, that is either put them into your <code>CLASSPATH</code>,
<code>ANT_HOME/lib</code> directory or a nested
<code><classpath></code> element of the mapper - you cannot have
<code>optional.jar</code> in <code>ANT_HOME/lib</code> and the library
<code>ant-[jakarta-oro, jakarta-regexp, apache-oro, apache-regexp].jar</code> in <code>ANT_HOME/lib</code>
and the library
in a nested <code><classpath></code>.</p>
<p>Ant will choose the regular-expression library based on the
following algorithm:</p>
@@ -337,8 +403,8 @@ jakarta-ORO and finally try jakarta-regexp.</li>
</tr>
</table>
<blockquote><pre>
<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1" />
<regexpmapper from="^(.*)\.(.*)$$" to="\2.\1" />
<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1" />
<regexpmapper from="^(.*)\.(.*)$$&" to="\2.\1" />
</pre></blockquote>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -363,8 +429,8 @@ jakarta-ORO and finally try jakarta-regexp.</li>
</tr>
</table>
<blockquote><pre>
<mapper type="regexp" from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java" />
<regexpmapper from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java" />
<mapper type="regexp" from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java" />
<regexpmapper from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java" />
</pre></blockquote>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -388,7 +454,65 @@ jakarta-ORO and finally try jakarta-regexp.</li>
<td valign="top"><code>java/lang/ClassLoader.java</code></td>
</tr>
</table>
<p>
The regexpmapper mapper can take the following extra attributes.
</p>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">casesensitive</td>
<td valign="top">
If this is false, the mapper will ignore case when matching the pattern.
This attribute can be true or false, the default is true.
<em>Since ant 1.6.3.</em>
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">handledirchar</td>
<td valign="top">
If this is specified, the mapper will treat a \ character in a filename
as a / for the purposes of matching.
This attribute can be true or false, the default is false.
This attribute is useful for cross-platform build files.
<em>Since ant 1.6.3.</em>
<td align="center" valign="top">No</td>
</tr>
</table>
<p>
An example:
</p>
<pre>
<pathconvert property="x" targetos="unix">
<path path="Aj.Java"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="a(*.)java" to="\1.java.bak" casesensitive="no"/>
</chainedmapper>
</pathconvert>
<echo>x is ${x}</echo>
</pre>
<p>
will output "x is j.java.bak".
</p>
<p>
and
</p>
<pre>
<pathconvert property="hd.prop" targetos="windows">
<path path="d\e/f\j.java"/>
<chainedmapper>
<regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirchar="yes"/>
</chainedmapper>
</pathconvert>
</pre>
<p>
will set <code>hd.prop</code> to "f\j.java".
</p>
<h4><a name="package-mapper">package</a></h4>
<p>Sharing the same syntax as the <a href="#glob-mapper">glob mapper</a>,
the package mapper replaces
@@ -504,6 +628,55 @@ with <code><uptodate></code> and <code><junit></code> output.</p>
<p>The chained mapper has no corresponding
<code><mapper <b>type</b>></code> attribute.
</p>
<!-- -->
<!-- Filter Mapper -->
<!-- -->
<h4><a name="filter-mapper">filtermapper (since ant 1.6.3)</a></h4>
<p>
This mapper implementation applies a <a href="filterchain.html">filterchain</a>
to the source file name.
</p>
<b>Examples:</b>
<blockquote><pre>
<filtermapper>
<replacestring from="\" to="/"/>
</filtermapper>
</pre></blockquote>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Source file name</b></td>
<td valign="top"><b>Target file names</b></td>
</tr>
<tr>
<td valign="center"><code>foo\bar\A.java</code></td>
<td valign="top"><code>foo/bar/A.java</code></td>
</tr>
</table>
<blockquote><pre>
<filtermapper>
<scriptfilter language="beanshell">
self.setToken(self.getToken().toUpperCase());
</scriptfilter>
</filtermapper>
</pre></blockquote>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Source file name</b></td>
<td valign="top"><b>Target file names</b></td>
</tr>
<tr>
<td valign="center"><code>foo\bar\A.java</code></td>
<td valign="top"><code>FOO\BAR\A.JAVA</code></td>
</tr>
</table>
<p>The filtermapper has no corresponding
<code><mapper <b>type</b>></code> attribute.
</p>
<hr>
<p align="center">Copyright © 2000-2004 The Apache Software Foundation. All rights
Reserved.</p>