Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

AW: On error Redo some TasK

Jan Materne

2008-05-13


Author LoginPost Reply
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@(protected)]
> Gesendet: Dienstag, 13. Mai 2008 08:06
> An: user@(protected)
> 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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.