ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ninju Bohra <>
Subject Re: Delete files if error log exist
Date Wed, 07 Feb 2007 16:33:24 GMT appears you might have a problem (or two)...

First off... I do not believe you can nest abritary task nodes within a <fail> task...the
only sub-element permitted is a single <condition> element...I will defer to the ANT
docs but I believe that is right

Based on what you want to delete the files if a file is available.

The problem is:

Either the <available> task will find your 'log' file and the property 'error.log.exist'
at which point the <fail> task will trigger which will emit your message to the console,
HOWEVER the ant script will then stop...will not delete the files

ON the other hand if <available> task is unable to find the file, the property will
not be set...the <fail> will not trigger...however the <delete> will still execute.

My $.02 cents worth,



----- Original Message ----
From: Mikael Petterson (KI/EAB) <>
Sent: Tuesday, February 6, 2007 12:57:03 PM
Subject: Delete files if error log exist


I would like to confirm with you experts if I can write ( as below) to
delete some files if an
error log exist. Or is there a better way?



<available file="${log.dir}/${log}" type="file"
        <fail message="ERROR: Probable errors in the mom. Check
'error.log' in ${log.dir}" if="error.log.exist">
         <!--When generation fails. Remove all files since
we don't want the wrong files to be checked in.-->
          <fileset dir="${output.dir}/${gen.pkg}" includes="**/*.java"/>

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.

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

View raw message