You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Guy Catz <Gu...@waves.com> on 2008/08/14 17:56:25 UTC

how can tell if a property is set?

how can tell if a property is set?

I've tried using contrib this -
<if>
   <equals arg1="${var}" arg2="" />
   <then>

but, if ${var} was never been set, the result is actually FALSE...

I need something like -
<if>
    <set var="${var}" />
    <then>
    ...


[http://www.waves.com/Objects/Images/Others/signature_logo.jpg] Guy Catz
Release Manager


Waves Audio Ltd
Tel: +972 3 608 4041
www.waves.com<http://www.waves.com/>  www.maxx.com<http://www.maxx.com/>  www.sound.org<http://www.sound.org/>

        This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential or privileged information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender and delete the e-mail and attached documents.
















RE: how can tell if a property is set?

Posted by Martin Gainty <mg...@hotmail.com>.
Guy-

have you had a chance to use the looked at using available ?
http://ant.apache.org/manual/CoreTasks/available.html
and test with condition..
http://ant.apache.org/manual/CoreTasks/condition.html
?
HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything 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. 


> From: Guy.catz@waves.com
> To: user@ant.apache.org
> Date: Thu, 14 Aug 2008 11:56:25 -0400
> Subject: how can tell if a property is set?
> 
> how can tell if a property is set?
> 
> I've tried using contrib this -
> <if>
>    <equals arg1="${var}" arg2="" />
>    <then>
> 
> but, if ${var} was never been set, the result is actually FALSE...
> 
> I need something like -
> <if>
>     <set var="${var}" />
>     <then>
>     ...
> 
> 
> [http://www.waves.com/Objects/Images/Others/signature_logo.jpg] Guy Catz
> Release Manager
> 
> 
> Waves Audio Ltd
> Tel: +972 3 608 4041
> www.waves.com<http://www.waves.com/>  www.maxx.com<http://www.maxx.com/>  www.sound.org<http://www.sound.org/>
> 
>         This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential or privileged information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender and delete the e-mail and attached documents.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM

Re: how can tell if a property is set?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Try this:

<if>
   <isset  property  = "var"/>
   <then>
...

Note no ${var} just var

HTH,

Flossy

On Thu, 14 Aug 2008, Guy Catz wrote:

> how can tell if a property is set?
>
> I've tried using contrib this -
> <if>
>   <equals arg1="${var}" arg2="" />
>   <then>
>
> but, if ${var} was never been set, the result is actually FALSE...
>
> I need something like -
> <if>
>    <set var="${var}" />
>    <then>
>    ...
>
>
> [http://www.waves.com/Objects/Images/Others/signature_logo.jpg] Guy Catz
> Release Manager
>
>
> Waves Audio Ltd
> Tel: +972 3 608 4041
> www.waves.com<http://www.waves.com/>  www.maxx.com<http://www.maxx.com/>  www.sound.org<http://www.sound.org/>
>
>        This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential or privileged information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender and delete the e-mail and attached documents.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

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: how can tell if a property is set?

Posted by Steven Guitar <st...@mac.com>.
Guy,

something else i have started using is if i plan to call a target if a  
property is set, i put the if/unless attributes on that target like so:

<target name="displayPropIfExists" if=${myprop} >
	<echo>${myprop}</echo>
</target>

this is a silly example, but the idea is that if and only if the  
property exists, the given target will run. unless is used in the  
opposite manner.


On Aug 14, 2008, at 10:56 AM, Guy Catz wrote:

> how can tell if a property is set?
>
> I've tried using contrib this -
> <if>
>   <equals arg1="${var}" arg2="" />
>   <then>
>
> but, if ${var} was never been set, the result is actually FALSE...
>
> I need something like -
> <if>
>    <set var="${var}" />
>    <then>
>    ...
>
>
> [http://www.waves.com/Objects/Images/Others/signature_logo.jpg] Guy  
> Catz
> Release Manager
>
>
> Waves Audio Ltd
> Tel: +972 3 608 4041
> www.waves.com<http://www.waves.com/>  www.maxx.com<http://www.maxx.com/ 
> >  www.sound.org<http://www.sound.org/>
>
>        This e-mail transmission, and any documents, files or  
> previous e-mail messages attached to it, may contain confidential or  
> privileged information. If you are not the intended recipient, or a  
> person responsible for delivering it to the intended recipient, you  
> are hereby notified that any disclosure, copying, distribution or  
> use of any of the information contained in or attached to this  
> message is STRICTLY PROHIBITED. If you have received this  
> transmission in error, please immediately notify the sender and  
> delete the e-mail and attached documents.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


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