You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Carlos Ortiz <ch...@gmail.com> on 2008/05/13 08:06:24 UTC
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
AW: On error Redo some TasK
Posted by Ja...@rzf.fin-nrw.de.
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
Re: On error Redo some TasK
Posted by David Weintraub <qa...@gmail.com>.
Ant usually fails on a failed task. There are certain tasks where this
rule could be overturned "those with a "failson" parameter, but most
of the time, if something fails, you really want to stop the build
process.
However, there is a special task in the AntContrib directory that I've
used before called <trycatch>. This task will execute a particular set
of tasks, then if there is an error, you can catch it and do something
else:
On Tue, May 13, 2008 at 2:06 AM, Carlos Ortiz <ch...@gmail.com> wrote:
> 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
>
--
--
David Weintraub
qazwart@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org