ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: dynamically reading a property file
Date Fri, 13 Apr 2007 06:02:18 GMT

What exactly are you trying to achieve here?  In your example, you 
reference the name of the property you set the environment to....


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"/>

Output is:  "123"


At 03:53 PM 4/11/2007, you wrote:
 >Hi there,
 >Using ant, how can I dynamically read a property file?
 ><property prefix="myprop"
 >file="${base.dir}/config/properties/" />
 >so now to reference a property in that file
 >All I have to do is
 ><echo>${}</echo>   // prints bar
 >however, I don't know how to do something like this
 >now, say I pass in -Denv=abc, something like this, dosen't work..
 >where ${env} can be either abc or def
 >am I doing something stupid?
 >To unsubscribe, e-mail:
 >For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message