ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunil Goklani" <upsidedo...@hotmail.com>
Subject Dynamic references to properties files
Date Sat, 20 May 2006 01:05:47 GMT
Hi All,

I had a question on how I could use two variables to access information from 
my properties files.  I am trying to build an ant script to generate 
configuration files for all of my development, qa, and staging environments.

For example I have the following in a properties file:

#Configuration for adapterconfig.xml
adapterconfig.webpath=<property 
name="webPath">http://localhost:7001/cis-7.6.0</property>
assem1-adapterconfig.webpath=<property 
name="webPath">http://some-server.com:8185/cis-7.6.0</property>
assem2-adapterconfig.webpath=<property 
name="webPath">http://some-server2.com:8185/cis-7.6.0</property>

The first property is what developers use and check/label into the cvs.  The 
other values are what I am supposed to have for my respective environments.

Suppose I input "-Dset.environment=assem1" as a command line argument.  Is 
there a way possible for me to access the value of 
${assem1-adapterconfig.webpath} with a variable combination of 
"${${set.environment}-${adapterconfig.webpath}}".

I tried it like that and I got an error because it was replacing the actual 
value of "adapterconfig.webpath" before it even got to where I wanted it to.

Second approach:

I created a temp property and built out the correct string
<property name="p-temp" 
value="${set.open}${set.environment}-adapterconfig.webpath${set.close}"/>
the set.open and set.close are the ${ and } respectively.  However now in my 
destination file, it actually replaces with: 
"${assem1-adapterconfig.webpath}" and not the value itself.  Is there anyway 
I can make ant recognize this string as a property?

Thanks all in advance!

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Mime
View raw message