ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Q: Double-expansion - reading environment variables "dynamically" ?
Date Mon, 07 Jul 2003 11:23:57 GMT
<propertycopy> from the ant-contrib project at Sourceforge is what you 
want.

	Erik

p.s. No need to get impatient after less than a day of posting to the 
user list, especially on a weekend.  Not to mention that this has been 
answered numerous times on the list and the answer is surely in the 
archives and most likely at the jGuru Ant FAQ, and also in the Java 
Development With Ant book.

On Sunday, July 6, 2003, at 10:56  AM, Morten Mortensen wrote:
>
> Hi developers,
>
> I seem to have zero luck on the users-list... I am getting pretty
> impatient...
>
> To repeat: Given a defined property assigned the name of an
> environment-variable, how do I read the value of the
> environment-variable?
>
> Can it be done? How?
>
>      ?
>
> Regards,
> Morten Sabroe Mortensen
>
>
> -----Original Message-----
> From: Morten Mortensen
> To: 'user@ant.apache.org'
> Sent: 06-07-03 05:30
> Subject: Q: Double-expansion - reading environment variables 
> "dynamically"?
>
>
> Given a defined property "x" assigned the name of an
> environment-variable, how do I read the value of the
> environment-variable?
>
>
> I can read the environment-variable "XXX_HOME" by introducing the
> environment as "env" and using "${env.XXX_HOME}" in my Ant-file.
>
> But what if "XXX_HOME" is specified as the value of a property?
>
>
> Constructed example:
>
>   <target
>     name="test"
>>
>     <property environment="env"/>
>
>     <!-- Property wired here for the example; is to be read by other
> means: -->
>     <property name="x" value="XXX_HOME"/>
>
>     <!-- Gee, does some kind of double-expansion work?: -->
>     <property name="v" value="${env.${x}}"/>
>
>     <!-- Would like to see the value identical to "${env.XXX_HOME}"
> here: -->
>     <echo>Result: ${v}</echo>
>   </target>
>
>
> If anyone knows how to do this, please tell me how.
>
>     ?
>
> Morten Sabroe Mortensen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>


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


Mime
View raw message