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 09:39:09 UTC
How to use nested if in ant script?
Hi,
How do I use nested <if> tag in ant script. I want to check 2 strings
and if both are true then it has to do some action. I did like this but
getting You must not nest more than one condition into if
<if>
<equals arg1="abc" arg2="abc"/>
<and>
<equals arg1="def" arg2="defl"/>
</and>
<then>
<echo>success</echo>
<property name="letter" value="abcdef" />
</then>
</if>
--
View this message in context: http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368213.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
Re: How to use nested if in ant script?
Posted by NR031 <na...@cognizant.com>.
Hi Peter,
Thanks for your quick reply.
===============================================================================
Peter Reilly-2 wrote:
>
> <if>
> <and>
> <equals arg1="abc" arg2="abc"/>
> <equals arg1="def" arg2="def"/>
> </and>
> <then>
> </then>
> <else>
> </else>
> </if>
>
> On Fri, Mar 6, 2009 at 8:45 AM, NR031 <na...@cognizant.com> wrote:
>>
>> Hi all,
>>
>>
>> I found out the solution myself :
>>
>> <if>
>> <equals arg1="abc" arg2="abc"/>
>> <then>
>> <if>
>> <equals arg1="def" arg2="def"/>
>> <then>
>> <echo>success</echo>
>> <property name="letter" value="abcdef" />
>> <echo>${letter}</echo>
>> </then>
>> </if>
>> </then>
>> <else>
>> <echo>Not equal</echo>
>> </else>
>> </if>
>>
>> ===============================================================================
>>
>> NR031 wrote:
>>>
>>> Hi,
>>>
>>> How do I use nested <if> tag in ant script. I want to check 2
>>> strings
>>> and if both are true then it has to do some action. I did like this but
>>> getting You must not nest more than one condition into if
>>>
>>> <if>
>>> <equals arg1="abc" arg2="abc"/>
>>> <and>
>>> <equals arg1="def" arg2="defl"/>
>>> </and>
>>> <then>
>>> <echo>success</echo>
>>> <property name="letter" value="abcdef" />
>>> </then>
>>> </if>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368288.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
>
>
>
--
View this message in context: http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368727.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
Re: How to use nested if in ant script?
Posted by Peter Reilly <pe...@gmail.com>.
<if>
<and>
<equals arg1="abc" arg2="abc"/>
<equals arg1="def" arg2="def"/>
</and>
<then>
</then>
<else>
</else>
</if>
On Fri, Mar 6, 2009 at 8:45 AM, NR031 <na...@cognizant.com> wrote:
>
> Hi all,
>
>
> I found out the solution myself :
>
> <if>
> <equals arg1="abc" arg2="abc"/>
> <then>
> <if>
> <equals arg1="def" arg2="def"/>
> <then>
> <echo>success</echo>
> <property name="letter" value="abcdef" />
> <echo>${letter}</echo>
> </then>
> </if>
> </then>
> <else>
> <echo>Not equal</echo>
> </else>
> </if>
>
> ===============================================================================
>
> NR031 wrote:
>>
>> Hi,
>>
>> How do I use nested <if> tag in ant script. I want to check 2 strings
>> and if both are true then it has to do some action. I did like this but
>> getting You must not nest more than one condition into if
>>
>> <if>
>> <equals arg1="abc" arg2="abc"/>
>> <and>
>> <equals arg1="def" arg2="defl"/>
>> </and>
>> <then>
>> <echo>success</echo>
>> <property name="letter" value="abcdef" />
>> </then>
>> </if>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368288.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: How to use nested if in ant script?
Posted by NR031 <na...@cognizant.com>.
Hi all,
I found out the solution myself :
<if>
<equals arg1="abc" arg2="abc"/>
<then>
<if>
<equals arg1="def" arg2="def"/>
<then>
<echo>success</echo>
<property name="letter" value="abcdef" />
<echo>${letter}</echo>
</then>
</if>
</then>
<else>
<echo>Not equal</echo>
</else>
</if>
===============================================================================
NR031 wrote:
>
> Hi,
>
> How do I use nested <if> tag in ant script. I want to check 2 strings
> and if both are true then it has to do some action. I did like this but
> getting You must not nest more than one condition into if
>
> <if>
> <equals arg1="abc" arg2="abc"/>
> <and>
> <equals arg1="def" arg2="defl"/>
> </and>
> <then>
> <echo>success</echo>
> <property name="letter" value="abcdef" />
> </then>
> </if>
>
--
View this message in context: http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368288.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 use nested if in ant script?
Posted by Ja...@rzf.fin-nrw.de.
>>> Use <groovy> ;)
>>
>> That brings me to ask: Does the new (?) <script> tag make ant-contrib
>> obsolete?
>
>It obsoletes any tasks that were trying to model programming language
>concepts on to XML (eeck). If, foreach, and similar tasks fall into
>this category.
I dont think that using <script> makes <ac:*> obsolete. Just think about
having
a bunch of nested tasks.
<ac:for>
<available file="flagfile"/>
<ac:then>
<echo>then</then>
<javac ...>
<copy todir=.."><fileset ..><modified/></fileset></copy>
</ac:then>
<ac:else>
<another-bunch-of-tasks/>
</ac:else>
</ac:for>
Writing with <script> could be more work ...
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to use nested if in ant script?
Posted by Brian Pontarelli <br...@pontarelli.com>.
>
>> Use <groovy> ;)
>
> That brings me to ask: Does the new (?) <script> tag make ant-contrib
> obsolete?
It obsoletes any tasks that were trying to model programming language
concepts on to XML (eeck). If, foreach, and similar tasks fall into
this category.
-bp
Re: How to use nested if in ant script?
Posted by Peter Reilly <pe...@gmail.com>.
On Mon, Mar 9, 2009 at 8:44 AM, Felix Dorner <FD...@zed.com> wrote:
>
>> Use <groovy> ;)
>
> That brings me to ask: Does the new (?) <script> tag make ant-contrib
> obsolete?
no
;-)
Peter
>
> Thanks for opinions,
> Felix
>
> ---------------------------------------------------------------------
> 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: How to use nested if in ant script?
Posted by Felix Dorner <FD...@zed.com>.
> Use <groovy> ;)
That brings me to ask: Does the new (?) <script> tag make ant-contrib
obsolete?
Thanks for opinions,
Felix
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to use nested if in ant script?
Posted by Brian Pontarelli <br...@pontarelli.com>.
Use <groovy> ;)
On Mar 6, 2009, at 1:39 AM, NR031 wrote:
>
> Hi,
>
> How do I use nested <if> tag in ant script. I want to check 2
> strings
> and if both are true then it has to do some action. I did like this
> but
> getting You must not nest more than one condition into if
>
> <if>
> <equals arg1="abc" arg2="abc"/>
> <and>
> <equals arg1="def" arg2="defl"/>
> </and>
> <then>
> <echo>success</echo>
> <property name="letter" value="abcdef" />
> </then>
> </if>
> --
> View this message in context: http://www.nabble.com/How-to-use-nested-if-in-ant-script--tp22368213p22368213.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