You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Pavel Muhataev <Pa...@moscow.vestedev.com> on 2002/03/04 11:45:17 UTC

IF statement

How can I write "If" statement?

I have some property and system variable. And I'd like to use property only
in case system variable is not set. How can I do this.

Or how can I display warning message in case of system property not defined.

Here is example.
    <property environment="env"/>
    <property name="was.home.default"
value="d:/Java/IBM/WebSphere/AppServer/lib"/>
    <property name="was.home.system"   value="${env.WAS_HOME}"/>
    ...
    And now, how can I define property "was.home" to use "was.home.system"
in case it is defined, or "was.home.default" in case of "was.home.system" is
not defined???
    


thanks
Paul Moukhataev.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: IF statement

Posted by Stefan Bodewig <bo...@apache.org>.
you don't need an if statement at all.

On Mon, 4 Mar 2002, Pavel Muhataev <Pa...@moscow.vestedev.com> wrote:

> Here is example.  

> <property environment="env"/> 
> <property name="was.home.default" 
>                 value="d:/Java/IBM/WebSphere/AppServer/lib"/>
> <property name="was.home.system" value="${env.WAS_HOME}"/>

> And now, how can I define property "was.home" to use
> "was.home.system" in case it is defined, or "was.home.default" in
> case of "was.home.system" is not defined???

<property environment="env"/>
<property name="env.WAS_HOME" value="d:/Java/IBM/WebSphere/AppServer/lib" />
<property name="was.home" value="${env.WAS_HOME}"/>

The second line will set the property env.WAS_HOME to your default
value, only if there is no environment variable named WAS_HOME.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>