ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <>
Subject copy updated files from several source trees to a flat directory
Date Wed, 24 Mar 2004 11:20:11 GMT

I am running Ant 1.5.3 with ant-contrib on Windows 2000. (I am holding 
off with Ant 1.6 until NetBeans 3.6 is released.)

I would like to copy a set of files from multiple source directory trees 
to one flat target directory, but only if the source files are newer 
than the target files.

I tried the following:

My source trees are ${jakarta.home}, ${build.lib.dir}, ....
The target directory is ${dist.dir}


<!-- jar files for distribution -->
<selector id="dist.libs">
     <filename name="**/gui.jar"/>
     <filename name="**/utilities.jar"/>
     <filename name="**/db.jar"/>
     <filename name="**/log4j*.jar"/>
     <filename name="**/commons-lang*.jar"/>
     <filename name="**/commons-collections*.jar"/>
     <filename name="**/${postgresql.lib}"/>

<target name="checkjar4changes">
   <outofdate outputsources="S" outputtargets="T">
       <fileset dir="${jakarta.home}" includes="**/*.jar">
         <selector refid="dist.libs"/>
     <mapper type="regexp" dir="${jakarta.home}"

copy files in foreach loop.

1) The above obviously only handles one source tree. I could specify 
multiple filesets but then I can't get the mapping to work.
2) ${dist.dir} is a subdirectory of ${basedir}. As I am working on 
Windows, the path contains back-slashes. These get stripped in the 
regexp mapper. I temporarily fudged ${dist.dir} by keying it in by hand 
with forward-slashes.

Any help is much appreciated.


Tarlika Elisabeth Schmitz

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

View raw message