You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Z W <mp...@gmail.com> on 2008/02/06 19:59:58 UTC

condition question

Hi

Why is this condition failing/false when "confused" is 1 ? I just don't see
it.

<echo> confused ${confused} </echo>

<condition property="retest6" value="3" else="6">

<equals arg1="${confused}" arg2="1" />

</condition>

<echo> retest ${retest}</echo>



_recheck:
     [echo]  confused 1
     [echo]
Condition false; setting retest6 to 6
Setting project property: retest6 -> 6
Property "retest" has not been set
     [echo]  retest ${retest}
Property "retest" has not been set

Re: condition question

Posted by "Scot P. Floess" <fl...@mindspring.com>.
I think you have an issue with your snippet...  You list retest6 and 
retest as properties...

Here is what I tried (note the consistent use of the property entitled 
retest6):


<project>
    <property  name = "confused"  value = "1"/>

    <echo> confused ${confused} </echo>

    <condition property="retest6" value="3" else="6">

        <equals arg1="${confused}" arg2="1" />

    </condition>

    <echo> retest ${retest6}</echo>
</project>

I get this:

     [echo]  confused 1
     [echo]  retest 3


If I don't set the property entitled confused (meaning it is never set), 
I get:

     [echo]  confused ${confused}
     [echo]  retest 6

The point is, you had a condition and set the property entitled retest6 
- but you output the property entitled retest?  Note no 6 in the 
property name...

Hope that helps...

Z W wrote:
> Hi
>
> Why is this condition failing/false when "confused" is 1 ? I just don't see
> it.
>
> <echo> confused ${confused} </echo>
>
> <condition property="retest6" value="3" else="6">
>
> <equals arg1="${confused}" arg2="1" />
>
> </condition>
>
> <echo> retest ${retest}</echo>
>
>
>
> _recheck:
>      [echo]  confused 1
>      [echo]
> Condition false; setting retest6 to 6
> Setting project property: retest6 -> 6
> Property "retest" has not been set
>      [echo]  retest ${retest}
> Property "retest" has not been set
>
>   

-- 
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: condition question

Posted by Z W <mp...@gmail.com>.
Folks
Steve was right. I have to use trim=yes.



On Feb 7, 2008 1:24 AM, Steve Loughran <st...@apache.org> wrote:

> Z W wrote:
> > Charbel
> > thanks for the response.
> > I still get the same problem with that small change.
> >
> >
> > <echo> confused ${confused} </echo>
> >
> > <condition property="retest6" value="3" else="6">
> >
> > <equals arg1="${confused}" arg2="5" />
> >
> > </condition>
> >
> > <echo> retest ${retest6}</echo>
> >
> >
> > _recheck:
> >      [echo]  confused 5
> >      [echo]
> > Condition false; setting retest6 to 6
> > Setting project property: retest6 -> 6
> >      [echo]  retest 6
> > Property "retest" has not been set
>
>
> Go <echo> confused [${confused}] </echo>
>
> I think there is whitespace in the property
>
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: condition question

Posted by Steve Loughran <st...@apache.org>.
Z W wrote:
> Charbel
> thanks for the response.
> I still get the same problem with that small change.
> 
> 
> <echo> confused ${confused} </echo>
> 
> <condition property="retest6" value="3" else="6">
> 
> <equals arg1="${confused}" arg2="5" />
> 
> </condition>
> 
> <echo> retest ${retest6}</echo>
> 
> 
> _recheck:
>      [echo]  confused 5
>      [echo]
> Condition false; setting retest6 to 6
> Setting project property: retest6 -> 6
>      [echo]  retest 6
> Property "retest" has not been set


Go <echo> confused [${confused}] </echo>

I think there is whitespace in the property

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

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


Re: condition question

Posted by Z W <mp...@gmail.com>.
Charbel
thanks for the response.
I still get the same problem with that small change.


<echo> confused ${confused} </echo>

<condition property="retest6" value="3" else="6">

<equals arg1="${confused}" arg2="5" />

</condition>

<echo> retest ${retest6}</echo>


_recheck:
     [echo]  confused 5
     [echo]
Condition false; setting retest6 to 6
Setting project property: retest6 -> 6
     [echo]  retest 6
Property "retest" has not been set

On Feb 6, 2008 11:12 AM, Charbel BITAR <bi...@gmail.com> wrote:

> Double check the name of the property in your code :
>
> <condition property="*retest6*" value="3" else="6">
> ...
> <echo> retest *${retest}*</echo>
> --
> Charbel
>
>
>
> On Feb 6, 2008 7:59 PM, Z W <mp...@gmail.com> wrote:
>
> > Hi
> >
> > Why is this condition failing/false when "confused" is 1 ? I just don't
> > see
> > it.
> >
> > <echo> confused ${confused} </echo>
> >
> > <condition property="retest6" value="3" else="6">
> >
> > <equals arg1="${confused}" arg2="1" />
> >
> > </condition>
> >
> > <echo> retest ${retest}</echo>
> >
> >
> >
> > _recheck:
> >     [echo]  confused 1
> >     [echo]
> > Condition false; setting retest6 to 6
> > Setting project property: retest6 -> 6
> > Property "retest" has not been set
> >     [echo]  retest ${retest}
> > Property "retest" has not been set
> >
>

Re: condition question

Posted by Charbel BITAR <bi...@gmail.com>.
Double check the name of the property in your code :

<condition property="*retest6*" value="3" else="6">
...
<echo> retest *${retest}*</echo>
--
Charbel



On Feb 6, 2008 7:59 PM, Z W <mp...@gmail.com> wrote:

> Hi
>
> Why is this condition failing/false when "confused" is 1 ? I just don't
> see
> it.
>
> <echo> confused ${confused} </echo>
>
> <condition property="retest6" value="3" else="6">
>
> <equals arg1="${confused}" arg2="1" />
>
> </condition>
>
> <echo> retest ${retest}</echo>
>
>
>
> _recheck:
>     [echo]  confused 1
>     [echo]
> Condition false; setting retest6 to 6
> Setting project property: retest6 -> 6
> Property "retest" has not been set
>     [echo]  retest ${retest}
> Property "retest" has not been set
>

RE: condition question

Posted by Martin Gainty <mg...@hotmail.com>.
can we see all the statements which set all the propertiesspecifiycally the property of retest ?(would be easier if we saw the entire build.xml..)
 
ThanksMartin ______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Wed, 6 Feb 2008 10:59:58 -0800> From: mpc8250@gmail.com> To: user@ant.apache.org> Subject: condition question> > Hi> > Why is this condition failing/false when "confused" is 1 ? I just don't see> it.> > <echo> confused ${confused} </echo>> > <condition property="retest6" value="3" else="6">> > <equals arg1="${confused}" arg2="1" />> > </condition>> > <echo> retest ${retest}</echo>> > > > _recheck:> [echo] confused 1> [echo]> Condition false; setting retest6 to 6> Setting project property: retest6 -> 6> Property "retest" has not been set> [echo] retest ${retest}> Property "retest" has not been set
_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008