ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: How to tell a task to fail if the fileset includes are missing?
Date Tue, 28 Oct 2003 10:26:56 GMT
On Fri, 24 Oct 2003, Matt Harp <> wrote:

> How can I tell the build.xml to fail if one of those files is not
> found?

The canonical way would be

<condition property="both.files.present">
    <available file="${src}/plugin.xml"/>
    <available file="${src}/"/>
<fail unless="both.files.present>
One of the required files is missing.

As an alternative you can use <zip> instead of <jar>

     <zip destfile="${dist}/${jarfilename}" compress="true"
          encoding="UTF8" whenempty="fail">
        <fileset dir="${src}" includes="plugin.xml" />
        <fileset dir="${src}" includes="" />

and run an additional <jar> after that if you need a manifest and want
to use Ant's default manifest.

Note that the <zip> version will only fail if neither file is there
while the first version (using <fail>) will fail if one of the two
files is missing.


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

View raw message