ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Davidson" <>
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 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="" />

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

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 that environment variable
property is already defined.


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


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


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 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: For 
>> additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: For additional

> commands, e-mail:

To unsubscribe, e-mail: For additional
commands, e-mail: 
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:
For additional commands, e-mail:

View raw message