import-bot (20211) [Avatar] Offline
<copy> with regexp mapper to delete directory hierarchy
[Originally posted by]


FIrst off, thanks for writing such a great book. I've been redoing our build
process from scratch to
support a master build.xml that kicks off standardized tasks in local
build.xml files for individual
subsystems, and the patterns in the book have been extremely useful. They've
helped me
eliminate around 600 lines of Ant build file code so far. smilie

I am currently dealing with the following problem. We have "testdataset"
directory hierarchies
distributed throughout our modules which all need to be consolidated into a
master testdataset
directory hierarchy for deployment. So, for example, our src directories might
include the


What I want to do is find all occurrences of the testdataset directories
whereever they are in our src
directories, and copy their subdirectory structure into a single build
testdataset direectory. So, the
example directories and files listed above would end up in the build area as:


I've fiddled around with various combinations of filesets and copy and flatten
and so forth to no
avail. Finally, I decided to RTFM, and on page 63 of your book, I came across
the following:

"Quite sophisticated mappings can occur with the regexp mapper, such as
removing a middle
piece of a directory hierarchy and other wacky tricks."

Wow! Sounds like exactly what I want to do! Unfortunately, there are no
examples of such
wackiness, only an admonition to stay away from doing it. I really believe
this to be a situation
where the ends justify the means. Given that you allude to exactly the sort
of thing I need to do, I
was wondering if you could be persuaded to post an example mapper invocation
that I could try
out for accomplishing this task.

Thanks very much,
Philip Johnson
import-bot (20211) [Avatar] Offline
Re: <copy> with regexp mapper to delete directory hierarchy
[Originally posted by erikhatcher]

There are some example usages in the Ant manual for the regexp mapper. Have a
look at those
and see if they'll get you going in the right direction. I, personally, don't
use regexp mapper in my
current project because there is not a need to, so it would take some
trial-and-error to come up
with the right solution for your situation.