What exactly are you trying to achieve here? In your example, you
reference the name of the property you set the environment to....
<echo>${myprop.${env}.abc}</echo>
Why do you have the ".abc" there? I would think your goal would be
to define each "env" value as a property,eg.. abc=123, def=456, then
reference the property without naming it. Is that what you are
aiming for? How about...
ant -Denv=abc
<expand prop="myprop.${env}"/>
<macrodef name="expand">
<attribute name="prop"/>
<sequential>
<echo>[EMAIL PROTECTED]</echo>
</sequential>
</macrodef>
Output is: "123"
Jake
At 03:53 PM 4/11/2007, you wrote:
>Hi there,
>
>Using ant, how can I dynamically read a property file?
>
>e.g.
>
><property prefix="myprop"
>file="${base.dir}/config/properties/myprop.properties" />
>
>so now to reference a property in that file
>
>foo=bar
>
>All I have to do is
>
><echo>${myprop.foo}</echo> // prints bar
>
>however, I don't know how to do something like this
>
>envAll=abc,def
>
>abc=abhay
>def=pradhan
>
>
>now, say I pass in -Denv=abc, something like this, dosen't work..
>
><echo>${myprop.${env}.abc}</echo>
>
>where ${env} can be either abc or def
>
>am I doing something stupid?
>
>cheers
>Abhay
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]