ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Dunn <nd...@uoregon.edu>
Subject Re: Reusing property values in a properties file
Date Mon, 12 Jul 2010 17:19:16 GMT

We had the same problem in our organization, so I created a specific ant task wrapping commons
config:

http://ant.apache.org/external.html

http://code.google.com/p/commonsconfiganttask/

I'm still updating docs, but it you should be able to do something to do exactly what you
suggested:

> USER_NAME=batuser
> DB_USERNAME=${USER_NAME}
> UNIX_USERNAME=${USER_NAME}


We use them as:

user1.properties defines:
> USER_NAME=batuser
> 
> include defaults.properties

defaults.properties defines:
> DB_USERNAME=${USER_NAME}
> UNIX_USERNAME=${USER_NAME}


The downside is not using explicit ant properties (though they are read in using the properties
files).

Nathan



On Jul 10, 2010, at 7:38 PM, anindya.mukherjee wrote:

> 
> I am using ant in my project as follows. I have templates of all environment
> files in our application.
> These templates have properties with placeholders in them like ->
> DB_SERVER=@DB_SERVER@
> For each environment we have a properties file. Like for dev we have
> dev.properties. This contains the actual value of the property like ->
> DB_SERVER=LNDB241
> We call ant like this -> ant create -Denv=dev
> The ant build file has this create task which uses the property values from
> the properties file to fill in the templates.
> 
> Now the question is , there are several properties that I reuse in the
> properties file. Like the directory name . Is there any way I can reuse the
> properties in the properties file like ( I am doing ant build in windows
> boxes ) ->
> 
> In dev.properties -->
> 
> USER_NAME=batuser
> DB_USERNAME=$USER_NAME}
> UNIX_USERNAME=$USER_NAME}
> 
> -- 
> View this message in context: http://old.nabble.com/Reusing-property-values-in-a-properties-file-tp29129304p29129304.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message