ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Stringer <...@burbong.com>
Subject Re: Using and checking an environment variable?
Date Tue, 06 Jun 2006 09:48:56 GMT
On Tue, 2006-06-06 at 11:41 +0200, johann.petrak@gmail.com wrote:
> I want to distribute the build.xml file with an application and therefore
> not include any paths to software the application depends on. Ideally I
> would want to take this from an environment variable and show an error
> message if the environment variable is not set.
> 
> Currently I set a property like this:
>   <property name="sw.home" location="${env.THE_VARIABLE}" />
> and later use sw.home wherever needed.
> 
> I cannot figure out how to best provide a default here or even better, abort
> with a descriptive error message if the environment variable is not set.

<property environment="env"/>
<fail message="MY_VAR not set. See README.txt" unless="env.MY_VAR"/>

Cheers, Ben

Ben Stringer ===== ben@burbong.com
==================================



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


Mime
View raw message