ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Davidson" <Je...@rocketgaming.com>
Subject RE: setting environment in external properties file
Date Thu, 23 Sep 2004 20:49:18 GMT
I don't think you can get around loading build.xml first, can you?  Your
config.properties is nothing on its own, and only gets loaded when you
tell it to at the top of your build.xml.

So, Doug's suggestion would be something like:

<property environment="env" />
<property file="config.properties" />

That would make the "env" prefix available for use (later) within
config.properties.

I did actually think of another possible solution: launch Ant, passing
in the environment variable you want:

ant -Dmy.var=%MY_ENV_VAR%

...then when you load config.properties that environment variable
property is already defined.

Cheers,
~Jeff

-----Original Message-----
From: Alan Jaynes [mailto:alan.jaynes@sri.com] 
Sent: September 23, 2004 13:42
To: Ant Users List
Subject: Re: setting environment in external properties file

doug-

thanks for the prompt response.  my question is whether or not i can
actually load the environment in an external file and not have to load
it first in a build.xml file

alan

Douglas Lochart wrote:

> Yes.  As long as you load the environment first you should be able to 
> reference those properties in a property file that will be loaded 
> later.  I have not actually accessed the ${env.CAR} as such from sa 
> property file but I have done this
>
> <prpoerty name="var" value="${env.VAR}"/>
>
> and then reference the property var in my property files.
> Hope this helps
>
> Doug
>
> Alan Jaynes wrote:
>
>> our ant build structure references a common config.properties file 
>> and i would like to reference an environment variable from my 
>> computer in that file.  i know you can set the environment in the 
>> build file with <property environment="env">, but is it possible to 
>> set the environment in the config file and the start referring to 
>> ${env.WHATEVER}?
>>
>> -alan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>> additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional

> commands, e-mail: user-help@ant.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org 
  
 
This electronic message transmission, including attachments, is for the exclusive use of the
individuals to which this e-mail is addressed and is to be reviewed and used exclusively for
authorized company purposes.  This transmission may contain proprietary, confidential or privileged
information.  If you are not the intended recipient of this transmission, you are hereby notified
that any use, copying, disclosure, dissemination, distribution or taking of any action in
reliance upon the contents of this transmission is strictly prohibited.  If you believe you
may have received this electronic message in error, please notify the sender immediately by
return email and delete or destroy the original message and/or any copy of it from your computer
system and/or your files.  Thank you. 

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


Mime
View raw message