You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jerry Brown <je...@wit-usa.com> on 2002/03/05 22:48:39 UTC

Nested variables

I am rewriting my build.xml file so that I can pass it a buildtype 
property value of "development" or "nightly" or "production". Depending 
on the buildtype, I will be substituting different values into my 
web.xml files using filtersets. So far, so good.

However, I would like to maintain all the values for the filtersets in 
the same properties file. My thought was doing something like this:

<filter token="replyToEmail" value="${${buildtype}.replyToEmail}"/>

where I would have a nightly.replyToEmail, a development.replyToEmail, 
and a production.replyToEmail property defined in the properties file.

Is it possible to have a variable inside another like that? If not, can 
I do something like "${(${buildtype}).replyToEmail}" ?

TIA,
Jerry

-- 
Jerry Brown
Worldwide Information Technologies
http://www.wit-usa.com
Email: jerry.brown@wit-usa.com
Phone: 214-678-1050, ext. 344


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Nested variables

Posted by Jerry Brown <je...@wit-usa.com>.
Laziness, pure and simple. I have a variety of machines that need to 
have large chunks of the properties files available to them, and 
updating and pushing out one file is easier. Less to mess with, less to 
mess up. I've been doing it with a multitude of properties files, but am 
looking for a Better Way.

It's strange that in all the talk of refactoring and getting rid of 
repetition in code, scripts, etc, that is the hallmark of XP and other 
methodologies, the same mindeset does not prevail when it comes to 
properties files.

Jerry

George McKinney wrote:
>>-----Original Message-----
>>From: Jerry Brown [mailto:jerry.brown@wit-usa.com]
>>Sent: Tuesday, March 05, 2002 1:49 PM
>>To: ant-user@jakarta.apache.org
>>Subject: Nested variables
>>
>>
>>I am rewriting my build.xml file so that I can pass it a buildtype
>>property value of "development" or "nightly" or "production".
>>...
>>Is it possible to have a variable inside another like that?
>>If not, can
>>I do something like "${(${buildtype}).replyToEmail}" ?
>>
>>TIA,
>>Jerry
>>
>>
> 
> I don't know if the nesting is possible, but wonder why you don't want to
> have separate property files (perhaps with a common.properties for the
> things that stay the same). I have used:
> 
> <property file="common.properties"/>
> <property file="${buildtype}.properties" />
> 
> on several projects with no particular difficulty.
> 
> 
> George McKinney, Developer
> Tantalus Communications Inc.
> 500-1122 Mainland Street
> Vancouver, BC, Canada V6B 5L1
> george@tantalus.com
> 
> Direct  604.726.6753
> Main    604.609.0700
> Fax     604.609.0705
> 
> "Building successful IT projects since 1994"
> www.tantalus.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
Jerry Brown
Worldwide Information Technologies
http://www.wit-usa.com
Email: jerry.brown@wit-usa.com
Phone: 214-678-1050, ext. 344


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Nested variables

Posted by George McKinney <ge...@tantalus.com>.
> -----Original Message-----
> From: Jerry Brown [mailto:jerry.brown@wit-usa.com]
> Sent: Tuesday, March 05, 2002 1:49 PM
> To: ant-user@jakarta.apache.org
> Subject: Nested variables
>
>
> I am rewriting my build.xml file so that I can pass it a buildtype
> property value of "development" or "nightly" or "production".
> ...
> Is it possible to have a variable inside another like that?
> If not, can
> I do something like "${(${buildtype}).replyToEmail}" ?
>
> TIA,
> Jerry
>

I don't know if the nesting is possible, but wonder why you don't want to
have separate property files (perhaps with a common.properties for the
things that stay the same). I have used:

<property file="common.properties"/>
<property file="${buildtype}.properties" />

on several projects with no particular difficulty.


George McKinney, Developer
Tantalus Communications Inc.
500-1122 Mainland Street
Vancouver, BC, Canada V6B 5L1
george@tantalus.com

Direct  604.726.6753
Main    604.609.0700
Fax     604.609.0705

"Building successful IT projects since 1994"
www.tantalus.com




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>