ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Allan <ste...@wrq.com>
Subject RE: How to detect missing files when copying from a list of files ?
Date Wed, 12 Feb 2003 01:37:49 GMT
EJ,

Thanks for the reply.  Sorry if I wasn't clear before - here's an example of
what I want to do.  Say I have a file called files.lst in the root of my
build with the contents:

 lib/foo.jar
 conf/foo.xml

I want to have an Ant task that reads the contents of files.lst and copies
the files listed in it to another directory, say a staging directory.  So
after running the task, I'd now have

  lib/foo.jar 
  conf/foo.xml
  stage/lib/foo.jar
  stage/conf/foo.xml

I want that task to fail if any either foo.jar or foo.xml is missing.  This
is a greatly simplified version; the real application might involve a
file.lst with hundreds of files explicitly listed.

You confirmed my observation that feeding a fileset to copy via the
includesfile element won't work.  Is there some other way to do this short
of <script> or exec'ing an external perl/shell script?

Thanks.

-- Steve


> -----Original Message-----
> From: Ciramella, EJ [mailto:ECiramella@emptoris.com] 
> Sent: Tuesday, February 11, 2003 2:01 PM
> To: 'Ant Users List'
> Subject: RE: How to detect missing files when copying from a 
> list of files ?
> 
> 
> Could I ask for a little more detail?  There may be other 
> ways around your
> problem.  
> 
> What are you copying?  Build.dir could be many things...
> 
> Take a closer look at FileSet - "includesfile the name of a 
> file; each line
> of this file is taken to be an include pattern. ".  This means the
> includesfile simply is a suggestion as to what patterns you 
> should include.
> If a file is missing, the copy isn't going to complain...
> 
> -----Original Message-----
> From: Steve Allan [mailto:stevea@wrq.com]
> Sent: Tuesday, February 11, 2003 4:52 PM
> To: 'user@ant.apache.org'
> Subject: How to detect missing files when copying from a list 
> of files?
> 
> 
> I'm having a recurring problem which I haven't been able to solve
> in Ant. As an example, say I have a file manifest which contains 
> all the files I expect to have in my distribution. I copy that to a 
> staging directory with copy and fileset:
> 
> <copy todir = "${stage.dir}">
>   <fileset dir = "${build.dir}" includesfile = "${file.lst}"/>
> </copy>
> 
> The problem is that if there are files in ${file.lst} that are missing
> (perhaps never built), fileset throws them out and copy never knows
> anything about them. It seems like <filelist> would solve that
> problem, because it would pass all the file names to <copy>, and then
> <copy> would complain about the missing ones. But <copy> won't accept
> a filelist. I really need the task to fail if any file in ${file.lst}
> is not found in ${build.dir}. 
> 
> Is there a cookbook solution to this problem?
> 
> -- Steve __ 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
View raw message