ant-user mailing list archives

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

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">
   <or>
     <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}"/>
     </or>
</selector>

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

copy files in foreach loop.

---------------------------
Problems:
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.
-- 


Regards,

Tarlika Elisabeth Schmitz

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message