|
|
@@ -62,6 +62,12 @@ with the following attributes:</p> |
|
|
implementation.</td> |
|
|
implementation.</td> |
|
|
<td align="center" valign="top">Depends on implementation.</td> |
|
|
<td align="center" valign="top">Depends on implementation.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td valign="top">chained</td> |
|
|
|
|
|
<td valign="top">Whether to chain nested <CODE><mapper></CODE>s. |
|
|
|
|
|
<i>Since Ant 1.7</i></td> |
|
|
|
|
|
<td align="center" valign="top">No, default is <CODE>false</CODE>.</td> |
|
|
|
|
|
</tr> |
|
|
</table> |
|
|
</table> |
|
|
<p>Note that Ant will not automatically convert / or \ characters in |
|
|
<p>Note that Ant will not automatically convert / or \ characters in |
|
|
the <code>to</code> and <code>from</code> attributes to the correct |
|
|
the <code>to</code> and <code>from</code> attributes to the correct |
|
|
@@ -71,14 +77,30 @@ this separator, use <code>${file.separator}</code> instead.</p> |
|
|
<p>The classpath can be specified via a nested |
|
|
<p>The classpath can be specified via a nested |
|
|
<code><classpath></code>, as well - that is, |
|
|
<code><classpath></code>, as well - that is, |
|
|
a <a href="../using.html#path">path</a>-like structure.</p> |
|
|
a <a href="../using.html#path">path</a>-like structure.</p> |
|
|
|
|
|
<p><b>Since Ant 1.7,</b> nested File Mappers can |
|
|
|
|
|
be supplied via either <CODE><mapper></CODE> elements or |
|
|
|
|
|
<a href="../CoreTasks/typedef.html"><code><typedef></code></a>'d |
|
|
|
|
|
implementations of <CODE>org.apache.tools.ant.util.FileNameMapper</CODE>. |
|
|
|
|
|
If one or more nested File Mappers are specified using either convention, |
|
|
|
|
|
only the <i>chained</i> attribute will be considered in the configuration |
|
|
|
|
|
of the implicitly used <a href="#container-mapper">container mapper</a>. |
|
|
|
|
|
</p> |
|
|
|
|
|
<hr/> |
|
|
<h3>The built-in mapper types are:</h3> |
|
|
<h3>The built-in mapper types are:</h3> |
|
|
<p>All built-in mappers are case-sensitive.</p> |
|
|
<p>All built-in mappers are case-sensitive.</p> |
|
|
|
|
|
<p><b>As of Ant 1.7,</b> each of the built-in mapper implementation |
|
|
|
|
|
types is directly accessible using a specific tagname. This makes it |
|
|
|
|
|
possible for filename mappers to support attributes in addition to |
|
|
|
|
|
the generally available <i>to</i> and <i>from</i>.<br/> |
|
|
|
|
|
The <code><mapper type|classname="..."></code> usage |
|
|
|
|
|
form remains valid for reasons of backward compatibility.</p> |
|
|
<h4><a name="identity-mapper">identity</a></h4> |
|
|
<h4><a name="identity-mapper">identity</a></h4> |
|
|
<p>The target file name is identical to the source file name. Both |
|
|
<p>The target file name is identical to the source file name. Both |
|
|
<code>to</code> and <code>from</code> will be ignored.</p> |
|
|
<code>to</code> and <code>from</code> will be ignored.</p> |
|
|
<b>Examples:</b> |
|
|
<b>Examples:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="identity"/> |
|
|
<mapper type="identity"/> |
|
|
|
|
|
<identitymapper /> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -109,6 +131,7 @@ leading directory information stripped off. Both <code>to</code> and |
|
|
<b>Examples:</b> |
|
|
<b>Examples:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="flatten"/> |
|
|
<mapper type="flatten"/> |
|
|
|
|
|
<flattenmapper /> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -138,6 +161,7 @@ leading directory information stripped off. Both <code>to</code> and |
|
|
<h5>Examples:</h5> |
|
|
<h5>Examples:</h5> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="merge" to="archive.tar"/> |
|
|
<mapper type="merge" to="archive.tar"/> |
|
|
|
|
|
<mergemapper to="archive.tar"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -172,6 +196,7 @@ that don't match the <code>from</code> pattern will be ignored.</p> |
|
|
<b>Examples:</b> |
|
|
<b>Examples:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="glob" from="*.java" to="*.java.bak"/> |
|
|
<mapper type="glob" from="*.java" to="*.java.bak"/> |
|
|
|
|
|
<globmapper from="*.java" to="*.java.bak"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -197,6 +222,7 @@ that don't match the <code>from</code> pattern will be ignored.</p> |
|
|
</table> |
|
|
</table> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="glob" from="C*ies" to="Q*y"/> |
|
|
<mapper type="glob" from="C*ies" to="Q*y"/> |
|
|
|
|
|
<globmapper from="C*ies" to="Q*y"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -267,6 +293,7 @@ jakarta-ORO and finally try jakarta-regexp.</li> |
|
|
<b>Examples:</b> |
|
|
<b>Examples:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="regexp" from="^(.*)\.java$$" to="\1.java.bak"/> |
|
|
<mapper type="regexp" from="^(.*)\.java$$" to="\1.java.bak"/> |
|
|
|
|
|
<regexpmapper from="^(.*)\.java$$" to="\1.java.bak"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -292,6 +319,7 @@ jakarta-ORO and finally try jakarta-regexp.</li> |
|
|
</table> |
|
|
</table> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="regexp" from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\2/\2-\3"/> |
|
|
<mapper type="regexp" from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\2/\2-\3"/> |
|
|
|
|
|
<regexpmapper from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\2/\2-\3"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -317,6 +345,7 @@ jakarta-ORO and finally try jakarta-regexp.</li> |
|
|
</table> |
|
|
</table> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/> |
|
|
<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/> |
|
|
|
|
|
<regexpmapper from="^(.*)\.(.*)$$" to="\2.\1"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -349,8 +378,8 @@ pattern placeholder. This mapper is particularly useful in combination |
|
|
with <code><uptodate></code> and <code><junit></code> output.</p> |
|
|
with <code><uptodate></code> and <code><junit></code> output.</p> |
|
|
<b>Example:</b> |
|
|
<b>Example:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="package" |
|
|
|
|
|
from="*Test.java" to="TEST-*Test.xml"/> |
|
|
|
|
|
|
|
|
<mapper type="package" from="*Test.java" to="TEST-*Test.xml"/> |
|
|
|
|
|
<packagemapper from="*Test.java" to="TEST-*Test.xml"/> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -375,8 +404,8 @@ with <code><uptodate></code> and <code><junit></code> output.</p> |
|
|
</p> |
|
|
</p> |
|
|
<b>Example:</b> |
|
|
<b>Example:</b> |
|
|
<blockquote><pre> |
|
|
<blockquote><pre> |
|
|
<mapper type="unpackage" |
|
|
|
|
|
from="TEST-*Test.xml" to="${test.src.dir}/*Test.java"> |
|
|
|
|
|
|
|
|
<mapper type="unpackage" from="TEST-*Test.xml" to="${test.src.dir}/*Test.java"> |
|
|
|
|
|
<unpackagemapper from="TEST-*Test.xml" to="${test.src.dir}/*Test.java"> |
|
|
</pre></blockquote> |
|
|
</pre></blockquote> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<table border="1" cellpadding="2" cellspacing="0"> |
|
|
<tr> |
|
|
<tr> |
|
|
@@ -388,7 +417,73 @@ with <code><uptodate></code> and <code><junit></code> output.</p> |
|
|
<td valign="top"><code>${test.src.dir}/org/acme/AcmeTest.java</code></td> |
|
|
<td valign="top"><code>${test.src.dir}/org/acme/AcmeTest.java</code></td> |
|
|
</tr> |
|
|
</tr> |
|
|
</table> |
|
|
</table> |
|
|
|
|
|
|
|
|
|
|
|
<h4><a name="container-mapper">container (since ant 1.7)</a></h4> |
|
|
|
|
|
<p>This mapper implementation can contain multiple nested mappers, |
|
|
|
|
|
and can process in one of two modes, controlled by the <i>chained</i> |
|
|
|
|
|
attribute. In the default mode, file mapping is performed by passing |
|
|
|
|
|
the source filename to each nested <code><mapper></code> in turn, |
|
|
|
|
|
returning all results. When <i>chained</i> is set to <CODE>true</CODE>, |
|
|
|
|
|
the source filename will be passed to the first nested mapper, its |
|
|
|
|
|
results will be passed to the second, and so on. The target filenames |
|
|
|
|
|
generated by the last nested mapper comprise the ultimate results of the |
|
|
|
|
|
mapping operation. The <i>to</i> and <i>from</i> attributes are ignored.</p> |
|
|
|
|
|
<b>Examples:</b> |
|
|
|
|
|
<blockquote><pre> |
|
|
|
|
|
<containermapper> |
|
|
|
|
|
<identitymapper /> |
|
|
|
|
|
<packagemapper from="*.java" to="*"/> |
|
|
|
|
|
</containermapper> |
|
|
|
|
|
</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" rowspan="2"><code>foo/bar/A.java</code></td> |
|
|
|
|
|
<td valign="top"><code>foo/bar/A.java</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td valign="top"><code>foo.bar.A</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</table> |
|
|
|
|
|
<blockquote><pre> |
|
|
|
|
|
<mapper chained="true"> |
|
|
|
|
|
<flattenmapper /> |
|
|
|
|
|
<globmapper from="*" to="new/path/*"/> |
|
|
|
|
|
<mapper> |
|
|
|
|
|
<globmapper from="*" to="*1"/> |
|
|
|
|
|
<globmapper from="*" to="*2"/> |
|
|
|
|
|
</mapper> |
|
|
|
|
|
</mapper> |
|
|
|
|
|
</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" rowspan="2"><code>foo/bar/A.java</code></td> |
|
|
|
|
|
<td valign="top"><code>new/path/A.java1</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td valign="top"><code>new/path/A.java2</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td valign="center" rowspan="2"><code>boo/far/B.java</code></td> |
|
|
|
|
|
<td valign="top"><code>new/path/B.java1</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td valign="top"><code>new/path/B.java2</code></td> |
|
|
|
|
|
</tr> |
|
|
|
|
|
</table> |
|
|
|
|
|
<p>Finally, the container mapper is <b>not</b> built-in in the same sense |
|
|
|
|
|
as the others. It is available via its own typedef, |
|
|
|
|
|
<code><containermapper></code>, and the use of a common |
|
|
|
|
|
<code><mapper></code> element with nested mappers will, as mentioned |
|
|
|
|
|
previously, make implicit use of a container mapper. The container |
|
|
|
|
|
mapper is <b>not</b> available, however (nor does it need to be), using |
|
|
|
|
|
the common <code><mapper type="..."></code> syntax.</p> |
|
|
<hr> |
|
|
<hr> |
|
|
<p align="center">Copyright © 2000-2004 The Apache Software Foundation. All rights |
|
|
<p align="center">Copyright © 2000-2004 The Apache Software Foundation. All rights |
|
|
Reserved.</p> |
|
|
Reserved.</p> |
|
|
|