ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Setting a Property if it exists.
Date Sun, 03 Feb 2008 22:56:53 GMT
Use a condition task:

<condition
    property="Build"
    value="Build">
    <not>
        <isset property="ENV.BUILD">
   </not>
</condition>
<property "Build" value="${ENV.BUILD}"/>

The above should work. If ENV.BUILD isn't set, Build will be set. If
it is set, then the property "Build" won't be set. The <property> task
below the <condition> task won't change the value of the property
"Build" if "Build" already has a value.

On Feb 3, 2008 4:48 PM, Francisco Tolmasky <tolmasky@gmail.com> wrote:
> I'd like to use an environment variable for my build directory if it
> exists, basically:
>
> <property environment = "ENV" />
> <property name = "Build" value = "${ENV.BUILD}" />
>
> However, I also want a default Build directory "Build", if ENV.BUILD
> doesn't exist, how
> do I do this given that setting the property cannot be undone?
>
> Thank you,
>
> Francisco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Mime
View raw message