ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: On error Redo some TasK
Date Tue, 13 May 2008 06:20:34 GMT
There is no built-in mechanism for that. 
If a task fails - the build fails.

You could try something with conditional targets and AntContrib:

<target name="targetA">
    <antcontrib:trycatch>
        ...
        <ac:catch>
            <property name="failed" value=""   description="A Failure somewhere"/>
            <property name="failed.A" value="" description="A Failure in 'A'. Just set
the prop, value doesnt matter"/>
</target>
<target name="targetB">
    ...same...
</target>
<target name="onErrorTargetATarget" if="failed">
    <echo>Some targets failed.</echo>
    <echo>- TargetA: ${failed.A}</echo>
</target>
<target name="mainTarget" depends="targetA, targetB, targetC, onErrorTargetATarget" >
    ...



Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Carlos Ortiz [mailto:chrono.dark@gmail.com] 
> Gesendet: Dienstag, 13. Mai 2008 08:06
> An: user@ant.apache.org
> Betreff: On error Redo some TasK
> 
> Hi,Here is my question, how do i redo or execute some task's 
> when another
> fail
> 
> for example , if targetA fail go to onErrorTargetATarget...
> 
>  <target name="targetA" >
>         ....
>     </target>
> 
>  <target name="onErrorTargetATarget" >
>         ....
> <delete ..... />
>     </target>
> 
> been the main mainTarget
> 
> 
>  <target name="mainTarget" depends="targetA, targetB, targetC" >
>         ....
>     </target>
> 
> thks in advance
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message