ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Bailey" <>
Subject RE: How do I delete files using a mapper?
Date Sat, 25 May 2002 18:45:59 GMT
Not to beat this silly (or maybe), but how would I specify this when I want
to map between a source file in one dir, and a target in another, where I'm
deleting the target?  Also, the target has a name that is prepended with
create_.  So, I have source files of the spec  .../foo/datamodel/*.dm, and
then after those get processed, they are turned into .../foo/create_*.sql.
Where the "*" part matches of course.  I tried this:

  <fileset dir="foo" includes="create_*.sql">
    <presentselect targetdir="foo/datamodel">
      <mapper type="glob" from="*.dm" to="create_*.sql"/>

I also tried switching it around a few other ways, as maybe I don't
understand the targetdir and/or how the source files from the fileset are
mapped into the present selector.

Thanks for all the past help, as well as thanks in advance for this.

-----Original Message-----
From: Bruce Atherton []
Sent: Friday, May 24, 2002 4:30 PM
To: Ant Users List
Subject: Re: How do I delete files using a mapper?

At 11:18 AM 5/24/2002 -0700, Chris Bailey wrote:
>I have a task that turns .xml files into .java files, that reside in the
>same source dir as the rest of my .java files.  But, I want to be able to
>"clean" those generated java files.  So, in my clean target I'd like to use
>the delete task, but with a Mapper.  But, delete doesn't support Mappers.
>So, what is the proper way to do such a thing?

Although I'm sure Diane's method would work, if you are using the latest
Ant from CVS you could also use the <present> selector. Off the top of my
head (and untested), something like this:

<delete dir="${src}">
     <fileset dir="${src}" >
         <include name="**/*.java"/>
         <present targetdir="$src">
            <mapper type="glob" from="*.java" to="*.xml" />

If you are using 1.5 Beta1 then you have to use <presentselect> instead of
<present>, but that should change with the next Ant release.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message