ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Atherton <>
Subject Re: fileset question
Date Sat, 12 Oct 2002 00:59:49 GMT
At 07:43 PM 10/10/2002 -0600, Elizabeth Cooper wrote:

>So, I still need a way to "match","map", or otherwise form a fileset which 
>exactly corresponds to the *.java files in my original fileset. These 
>resources are *.gif, *.properties that have a filename that starts with 
>the same "*" of *.java.

I think that first you actually need to copy your java fileset to a new 
directory, since Ant doesn't provide manipulation of a fileset's entries in 
memory (though it is an interesting idea). Let's call the new directory 

The problem you want to solve is finding the substring of the larger 
resource file name that will match the java file. Given "Bean32.gif", you 
need to know whether there are any of "", "",", "", "", or "" in ${dest}.

Again, I'm going to suggest you need a custom mapper here that could 
provide that type of mapping. It could take the filename passed in and 
strip it, character by character, and replace the "*" in the mapper's "to" 
attribute. If it found any file with that name, it could map to it and pass 
that back to <present>.

Once you had that, you could do something like:

   <fileset id="new.file.set" dir="${source}">
         <filename name="**/*.gif" />
         <filename name="**/*.properties />
       <present targetdir="${dest}">
         <mapper classname="my.package.MyMapper" to="*.java" />

I agree with Erik and Diane that the long term solution is to organize your 
directory structure so that is better supports your build needs. Hopefully 
this is a short term solution that works for you, though.

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

View raw message