ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: conditional fileset
Date Thu, 05 Sep 2002 18:35:38 GMT
It's not pretty, but you could use Ant-contrib <tryCatch> which would
reference the <fileset> internally, and if that throws an exception, then
the <fileset> was not defined:

<trycatch property="fileset.notdefined">
    <fileset refid="ID of fileset that may exist" />
  <catch />

I'm not sure whether that's what you want, or whether the <catch> block
needs to contain a task. --DD

-----Original Message-----
From: Ilja Preuß [] 
Sent: Thursday, September 05, 2002 3:26 AM
To: Ant Users List
Subject: Re: conditional fileset

> > The problem I am facing is that that target should be executed
> > automatically from some other targets [...] but
> > *only* if the fileset is defined (obviously...).
> If by "defined" you mean contains files:

No, by "defined" I mean - well, defined... :-)

The projects scripts need to define wether something needs to be copied, and
if so, which files.

The files can easily be defined through a fileset. Obviously, if nothing
needs to be copied, you don't need to define the fileset, so I thought to
use the *existence* of the fileset as the trigger to copy the files.

That is, I have a generic target

<target name="copyConfig" if="???">
   <copy toDir="${cadenza.dist}/config">
      <fileset refid="resources.config"/>

So, if a project defines a fileset "resources.config", those files should
get copied. If there is no fileset associated to that id, the target should
be skipped.

Is it possible to somehow check for the existence of a fileset? (Mhh,
checking wether a specific ID is in use would in fact suffice, I guess...)

Thanks for your help, Ilja

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

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

View raw message