You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/11/18 16:24:39 UTC

svn commit: r718633 - in /ant/core/trunk: WHATSNEW docs/manual/CoreTypes/resources.html src/tests/antunit/taskdefs/war-test.xml

Author: bodewig
Date: Tue Nov 18 07:24:38 2008
New Revision: 718633

URL: http://svn.apache.org/viewvc?rev=718633&view=rev
Log:
document mappedresources

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/CoreTypes/resources.html
    ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=718633&r1=718632&r2=718633&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Nov 18 07:24:38 2008
@@ -534,6 +534,11 @@
    operating systems repsectively.
    Bugzilla Report 7624.
 
+ * a new resource collection <mappedresources> generalizes the prefix
+   and fullpath attributes of <zipfileset> to arbitrary mappers that
+   can be applied to arbitrary resource collections.
+   Bugzilla Report 4240.
+
 Changes from Ant 1.7.0 TO Ant 1.7.1
 =============================================
 

Modified: ant/core/trunk/docs/manual/CoreTypes/resources.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTypes/resources.html?rev=718633&r1=718632&r2=718633&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTypes/resources.html (original)
+++ ant/core/trunk/docs/manual/CoreTypes/resources.html Tue Nov 18 07:24:38 2008
@@ -346,6 +346,9 @@
     of nested resource collections</li>
   <li><a href="#difference">difference</a> - set difference
     of nested resource collections</li>
+  <li><a href="#mappedresources">mappedresources</a> - generic
+    resource collection wrapper that maps the names of the nested
+    resources using a <a href="mapper.html">mapper</a>.</li>
 </ul>
 <h4><a name="resources">resources</a></h4>
 <p>A generic resource collection, designed for use with
@@ -1017,7 +1020,60 @@
   </pre>
 </blockquote>
 
+<h4><a name="mappedresources">mappedresources</a></h4>
 
+<p>Wraps another resource collection and maps the names of the nested
+  resources using a <a href="mapper.html">mapper</a>.</p>
+
+<p>Even if <em>mappedresources</em> wraps a resource collection that
+  consists of file-system based resources, <em>mappedresources</em>
+  will not appear to be file-system based.  This means you can't
+  use <em>mappedresources</em> with tasks that only allow file-system
+  based resources.</p>
+
+<p><em>mappedresources</em> doesn't support any attributes.</p>
+
+<blockquote>
+  <h4>Parameters specified as nested elements</h4>
+  <p>A single resource collection is required.</p>
+  <p>A single <a href="mapper.html">mapper</a> can be used to map
+    names.  If no mapper has been given (which doesn't make any sense,
+    honestly), an identity mapper will be used.</p>
+
+  <h4>Examples</h4>
+
+  <p>Copies all files from a given directory to a target directory
+    adding ".bak" as an extension.  Note this could be done with a
+    <em>mapper</em> nested into <em>copy</em> directly as well.</p>
+
+  <pre>
+    &lt;copy todir="${target}"&gt;
+      &lt;mapperesources&gt;
+        &lt;fileset dir="${src}"/&gt;
+        &lt;globmapper from="*" to="*.bak"/&gt;
+      &lt;/mapperesources&gt;
+    &lt;/copy&gt;
+  </pre>
+
+  <p>Creates a WAR archive adding all CLASSPATH entries that are files
+    to the <code>WEB-INF/lib</code> directory without keeping their
+    files-system structure.</p>
+
+  <pre>
+    &lt;war destfile="${output}"&gt;
+      &lt;mappedresources&gt;
+        &lt;restrict&gt;
+          &lt;path path="${java.class.path}"/&gt;
+          &lt;type type="file"/&gt;
+        &lt;/restrict&gt;
+        &lt;chainedmapper&gt;
+          &lt;flattenmapper/&gt;
+          &lt;globmapper from="*" to="WEB-INF/lib/*"/&gt;
+        &lt;/chainedmapper&gt;
+      &lt;/mappedresources&gt;
+    &lt;/war&gt;
+  </pre>    
+</blockquote>
 
 </body>
 </html>

Modified: ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml?rev=718633&r1=718632&r2=718633&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml Tue Nov 18 07:24:38 2008
@@ -168,4 +168,22 @@
     <au:assertFileExists file="${working.dir}/WEB-INF/lib/web.xml" />
   </target>
 
+  <target name="testMappedClasspathFromManual">
+    <mkdir dir="${input}"/>
+    <mkdir dir="${output}/out"/>
+    <war destfile="${output}/test.war" webxml="${ant.file}">
+      <mappedresources>
+        <restrict>
+          <path path="${java.class.path}"/>
+          <type type="file"/>
+        </restrict>
+        <chainedmapper>
+          <flattenmapper/>
+          <globmapper from="*" to="WEB-INF/lib/*"/>
+        </chainedmapper>
+      </mappedresources>
+    </war>
+    <unzip src="${output}/test.war" dest="${output}/out"/>
+    <au:assertFileExists file="${output}/out/WEB-INF/lib/ant.jar"/>
+  </target>
 </project>



Re: svn commit: r718633 - in /ant/core/trunk: WHATSNEW docs/manual/CoreTypes/resources.html src/tests/antunit/taskdefs/war-test.xml

Posted by Stefan Bodewig <bo...@apache.org>.
On 2008-11-19, <Ja...@rzf.fin-nrw.de> wrote:

> Are these closed now?

I obviously didn't search hard enough for duplicates. 8-)


> * https://issues.apache.org/bugzilla/show_bug.cgi?id=19523
>   zip/unzip should have the capability to use a mapper
>   Opened: 2003-05-01 18:01 PST

Not fully since the initial use case involves zipgroupfileset which is
not a resource collection and thus cannot be wrapped in
mappedresources.


> * https://issues.apache.org/bugzilla/show_bug.cgi?id=31947
>   War task should flatten files in <lib> element
>   Opened: 2004-10-28 21:17 PST

Yep, I closed it just now.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


AW: svn commit: r718633 - in /ant/core/trunk: WHATSNEW docs/manual/CoreTypes/resources.html src/tests/antunit/taskdefs/war-test.xml

Posted by Ja...@rzf.fin-nrw.de.
>+ * a new resource collection <mappedresources> generalizes the prefix
>+   and fullpath attributes of <zipfileset> to arbitrary mappers that
>+   can be applied to arbitrary resource collections.
>+   Bugzilla Report 4240.
>+
>+  <p>Creates a WAR archive adding all CLASSPATH entries that are files
>+    to the <code>WEB-INF/lib</code> directory without keeping their
>+    files-system structure.</p>
>+
>+  <pre>
>+    &lt;war destfile="${output}"&gt;
>+      &lt;mappedresources&gt;
>+        &lt;restrict&gt;
>+          &lt;path path="${java.class.path}"/&gt;
>+          &lt;type type="file"/&gt;
>+        &lt;/restrict&gt;
>+        &lt;chainedmapper&gt;
>+          &lt;flattenmapper/&gt;
>+          &lt;globmapper from="*" to="WEB-INF/lib/*"/&gt;
>+        &lt;/chainedmapper&gt;
>+      &lt;/mappedresources&gt;
>+    &lt;/war&gt;
>+  </pre>    
>+</blockquote>


Are these closed now?
* https://issues.apache.org/bugzilla/show_bug.cgi?id=19523
  zip/unzip should have the capability to use a mapper
  Opened: 2003-05-01 18:01 PST
* https://issues.apache.org/bugzilla/show_bug.cgi?id=31947
  War task should flatten files in <lib> element
  Opened: 2004-10-28 21:17 PST


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org