ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike K. Cepek" <>
Subject fail <tar> when file does not exist
Date Fri, 13 Feb 2009 15:56:17 GMT
I'd like my <tar> task to fail if the files I specify don't exist.  I
currently make use of the prefix, username, group and (sometimes) mode
attributes of <tarfileset>, so I can't lose that functionality.

>From the Ant Manual, it looks like the new Resource Collection support
can handle this.  But as a mere Ant user, and not Ant expert, I'm
struggling with how to reformulate my <tar> task to accomplish this.  I
couldn't seem to locate any examples or tutorials for Resources.  So I
thought I'd write here for help.

Here's a reduced version of the task I want to fail.  If the menu.xml
file doesn't exist, I'd like the <tar> to abort:

<tar destfile="product.tar.gz" compression="gzip">
  <tarfileset dir="release/prod" prefix="conf" username="admin"
    <include name="spring/menu.xml"/>

Normally each <tar> has multiple <tarfileset>s which in turn have
multiple <include>s.

I tried adding <restrict> and <rsel:exist> and <control> and <resource
name="*">, but Eclipse (v3.4) doesn't seem to like my syntax, as it
claims "The prefix 'rsel' for element 'rsel:exist' is not bound", which
only confuses me more.  So...

1) Can I accomplish what I want to do with Resources and/or Resource
Collections?  If so, how should the above be rewritten?

2) Are there other resources, ideally with examples, to help illustrate
how to use Resources and Resource Collections?


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

View raw message