You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by NR031 <na...@cognizant.com> on 2009/03/06 11:04:40 UTC

How to skip the rest of execution

Hi,

   Ho to exit from executing the rest of targets if some conditions get
failed.

This is what I expect :

<target name="nested">
<if>
                <equals arg1="abc" arg2="def"/>
            <then>
                <echo>success</echo>
                <property name="letter" value="abc" />
                <echo>${letter}</echo>
            </then>
            <else>
                <echo>Not equal</echo>
                  *******Code For Exit**********
            </else>
        </if>
</nested>

<target name="callnested" depends="nested">
         <echo>I don't want to see this message in the command prompt</echo>
</target>



If I execute the target callnested then I shouldn't see the message of
callnested ("I don't want to see this message in the command prompt").
-- 
View this message in context: http://www.nabble.com/How-to-skip-the-rest-of-execution-tp22369239p22369239.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


AW: How to skip the rest of execution

Posted by Ja...@rzf.fin-nrw.de.
Two possibilities:
- a <fail> would exit the build immediately, but with state "failed"
- set a property "skip-rest" and add a condition 'unless="skip-rest"' on the targets

Jan 

>-----Ursprüngliche Nachricht-----
>Von: NR031 [mailto:nataraja.cp@cognizant.com] 
>Gesendet: Freitag, 6. März 2009 11:05
>An: user@ant.apache.org
>Betreff: How to skip the rest of execution
>
>
>Hi,
>
>   Ho to exit from executing the rest of targets if some conditions get
>failed.
>
>This is what I expect :
>
><target name="nested">
><if>
>                <equals arg1="abc" arg2="def"/>
>            <then>
>                <echo>success</echo>
>                <property name="letter" value="abc" />
>                <echo>${letter}</echo>
>            </then>
>            <else>
>                <echo>Not equal</echo>
>                  *******Code For Exit**********
>            </else>
>        </if>
></nested>
>
><target name="callnested" depends="nested">
>         <echo>I don't want to see this message in the command 
>prompt</echo>
></target>
>
>
>
>If I execute the target callnested then I shouldn't see the message of
>callnested ("I don't want to see this message in the command prompt").
>-- 
>View this message in context: 
>http://www.nabble.com/How-to-skip-the-rest-of-execution-tp22369
239p22369239.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: if and conditions

Posted by my...@gmail.com.
Sent via BlackBerry by AT&T

-----Original Message-----
From: Scott Stark <ss...@us.ibm.com>

Date: Fri, 6 Mar 2009 10:26:05 
To: Ant Users List<us...@ant.apache.org>
Subject: if and conditions


Dumb question, but where in the documentation
(http://ant.apache.org/manual/index.html) is there a discussion of <if> and
<conditions>?

thanks,
Scott



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


Re: if and conditions

Posted by Robert Anderson <ri...@gmail.com>.
You can also use the if and unless attributes of the target to control
certain behavior.

On Fri, Mar 6, 2009 at 10:59 AM, Scott Stark <ss...@us.ibm.com> wrote:

> >The <if> task is part of the AntContrib package which is available
> >from <?http://ant-contrib.sourceforge.net/>. Task descriptions are from
> ><http://ant-contrib.sourceforge.net/tasks/tasks/index.html>
>
> Thanks all for the replies. Yes I already found the <condition>
> documentation but there's nothing in there about <if>. I will look at the
> AntContrib package.
>
> Scott
>



-- 
Rob Anderson
riznob@gmail.com

Re: if and conditions

Posted by Scott Stark <ss...@us.ibm.com>.
>The <if> task is part of the AntContrib package which is available
>from <?http://ant-contrib.sourceforge.net/>. Task descriptions are from
><http://ant-contrib.sourceforge.net/tasks/tasks/index.html>

Thanks all for the replies. Yes I already found the <condition>
documentation but there's nothing in there about <if>. I will look at the
AntContrib package.

Scott

Re: if and conditions

Posted by David Weintraub <qa...@gmail.com>.
The Condition task is one of the "Core Tasks" of Ant. You'll see a
link on the left hand side of the manual for Ant Tasks. Select that,
then "Core Tasks". Condition should be there.

The <if> task is part of the AntContrib package which is available
from <http://ant-contrib.sourceforge.net/>. Task descriptions are from
<http://ant-contrib.sourceforge.net/tasks/tasks/index.html>

I don't believe that AntContrib tasks have been updated in years. I
don't even know if they're still maintained, but a lot of people use
them because they have some very nice features that are missing in the
regular ant tasks (like loops, try/throw, and if).

On Fri, Mar 6, 2009 at 11:26 AM, Scott Stark <ss...@us.ibm.com> wrote:
> Dumb question, but where in the documentation
> (http://ant.apache.org/manual/index.html) is there a discussion of <if> and
> <conditions>?
>
> thanks,
> Scott
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Re: if and conditions

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
if is from ant contrib

yes there is documentation on condition under core tasks

On Fri, 6 Mar 2009, Scott Stark wrote:

> Dumb question, but where in the documentation
> (http://ant.apache.org/manual/index.html) is there a discussion of <if> and
> <conditions>?
>
> thanks,
> Scott
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


Re: if and conditions

Posted by Ben Leedham <be...@upco.co.uk>.
I was looking at it today.

http://ant.apache.org/manual/CoreTasks/condition.html

On Fri, 2009-03-06 at 10:26 -0600, Scott Stark wrote:

> Dumb question, but where in the documentation
> (http://ant.apache.org/manual/index.html) is there a discussion of <if> and
> <conditions>?
> 
> thanks,
> Scott

-- 
Regards,

Ben Leedham

UPCO Consultant
Switchboard: 0113 201 0600
Direct     : 0113 201 0640
Fax        : 0113 201 0666
Email      : ben.leedham@upco.co.uk
Web        : http://www.upco.co.uk

if and conditions

Posted by Scott Stark <ss...@us.ibm.com>.
Dumb question, but where in the documentation
(http://ant.apache.org/manual/index.html) is there a discussion of <if> and
<conditions>?

thanks,
Scott