diff --git a/WHATSNEW b/WHATSNEW index ad3aef203..39f04b6d8 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -534,6 +534,11 @@ Other changes: operating systems repsectively. Bugzilla Report 7624. + * a new resource collection generalizes the prefix + and fullpath attributes of 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 ============================================= diff --git a/docs/manual/CoreTypes/resources.html b/docs/manual/CoreTypes/resources.html index 78ba73f6a..f53a26370 100644 --- a/docs/manual/CoreTypes/resources.html +++ b/docs/manual/CoreTypes/resources.html @@ -346,6 +346,9 @@ Ant's "legacy" datatypes have been modified to behave as Resource Collections: of nested resource collections
  • difference - set difference of nested resource collections
  • +
  • mappedresources - generic + resource collection wrapper that maps the names of the nested + resources using a mapper.
  • resources

    A generic resource collection, designed for use with @@ -1017,7 +1020,60 @@ larger collection. Since Ant 1.7.1.

    +

    mappedresources

    +

    Wraps another resource collection and maps the names of the nested + resources using a mapper.

    + +

    Even if mappedresources wraps a resource collection that + consists of file-system based resources, mappedresources + will not appear to be file-system based. This means you can't + use mappedresources with tasks that only allow file-system + based resources.

    + +

    mappedresources doesn't support any attributes.

    + +
    +

    Parameters specified as nested elements

    +

    A single resource collection is required.

    +

    A single mapper 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.

    + +

    Examples

    + +

    Copies all files from a given directory to a target directory + adding ".bak" as an extension. Note this could be done with a + mapper nested into copy directly as well.

    + +
    +    <copy todir="${target}">
    +      <mapperesources>
    +        <fileset dir="${src}"/>
    +        <globmapper from="*" to="*.bak"/>
    +      </mapperesources>
    +    </copy>
    +  
    + +

    Creates a WAR archive adding all CLASSPATH entries that are files + to the WEB-INF/lib directory without keeping their + files-system structure.

    + +
    +    <war destfile="${output}">
    +      <mappedresources>
    +        <restrict>
    +          <path path="${java.class.path}"/>
    +          <type type="file"/>
    +        </restrict>
    +        <chainedmapper>
    +          <flattenmapper/>
    +          <globmapper from="*" to="WEB-INF/lib/*"/>
    +        </chainedmapper>
    +      </mappedresources>
    +    </war>
    +  
    +
    diff --git a/src/tests/antunit/taskdefs/war-test.xml b/src/tests/antunit/taskdefs/war-test.xml index 1d07315bc..685be9996 100644 --- a/src/tests/antunit/taskdefs/war-test.xml +++ b/src/tests/antunit/taskdefs/war-test.xml @@ -168,4 +168,22 @@ + + + + + + + + + + + + + + + + + +