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 17:58:01 GMT
I messed around with this, but it seems that it doesn't work - it deletes
EVERY file in my hierarchy, not just .java files, and specifically, not
.java files that have an equivalent .xml file.  I've tried various
incarnations, and done this with both Ant 1.5Beta1 and 1.6alpha build from
last night.  I've tried a couple ways, but currently have it specified as:

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

Anyone know why it deletes ALL files and directories?  I would think that
the 'includes="**/*.java"' attribute for fileset would at least limit it to
.java files.

-----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