On error Redo some TasK

View: New views
3 Messages — Rating Filter:   Alert me  

On error Redo some TasK

by Carlos Ortiz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

by Jan.Materne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


Re: On error Redo some TasK

by David Weintraub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <chrono.dark@...> 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@...

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