> Now I want to copy the files below src/*/lib, or most of them.
> And I want to strip the leading two directories. I came up with
> the following solution, but it is clumsy and I think there is
> a better way that I'm missing.
It appears to me from the documentation of the Mapper Type [1]
that regexmapper/@handledirsep could be used to accomplish the job.
> <project default="copy">
> <property name="source.dir" location="src"/>
> <property name="target.dir" location="lib"/>
>
> <target name="copy">
> <copy todir="${target.dir}">
> <fileset dir="${source.dir}">
> <include name="*/lib/**/*.*"/>
> <exclude name="**/urmel.*"/>
> </fileset>
> <!-- portability: path separator logic redoubled in regexp -->
> <mapper type="regexp" from="^[-_a-zA-Z0-9]*[\\/]lib(.*)" to="\1"/>
It could fit in here.
> </copy>
> </target>
> </project>
Unfortunately, however, the <copy> task in Ant 1.8.1 does not support
a nested <regexmapper>.
copy doesn't support the nested "regexmapper" element.
You need a plain <mapper>, but:
mapper doesn't support the "handledirsep" attribute
Looks like there is still potential to improve composability.
[1] http://ant.apache.org/manual/Types/mapper.html
--
Michael Ludwig