ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: How to best create environment specific properties in an applications property file using ANT
Date Tue, 27 Feb 2007 19:20:24 GMT
This is a common issue. There are several ways to handle the issue.

1. Version a config file for each environment in source control and
decide which one to deploy at deployment time.

2. Version a template config file in version control that has
placeholders for the real values. Also version a properties file for
each environment. Then at deployement time, use Ant and the <replace>
task to generate an environment specific config file. 

3. A combination of 1 and 2 could be implemented where one template file
is versioned, and at build time you generate a config file for each
environment and package it all up. Then at deployment time, you decide
which config file to deploy.

Any of the above can be accomplished by creating a properties file for
each environment... dev.properties, qa.properties, uat.properties,
prod.properties, etc. In the build.xml you will use the template config
file and the <replace> task to generate an environment specific config
file.

There are a few different ways to specify what environment you are
building for, or deploying to.

1. Command line args....
ant -Denv=qa

2. Prompt the user using the <input> task.

I hope this helps.

-Rob Anderson


> -----Original Message-----
> From: Eric Wood [mailto:EWood@llbean.com] 
> Sent: Monday, February 26, 2007 7:09 AM
> To: Ant Users List
> Subject: How to best create environment specific properties 
> in an applications property file using ANT
> 
> Folks:
> 
> I'm looking at how to best create different copies of an 
> application property file using ANT.  I have a property file 
> that contains two
> sections: one section with environment specific settings that 
> will vary as it is deployed across test, QA, and production 
> servers and one section that is constant.  Currently, it is 
> versioned in our source code repository so it works in the 
> development environment; this way developers can work with it 
> directly in their environment without having to change it. 
> When I build their application using ANT I would like to 
> generate different versions of the file for environment that 
> I save save for later deployment.  I was looking at using 
> filterreaders but they are not really setup to substitute a 
> block of properties located in the middle of the file.
> 
> Any thoughts on how I can best do this task?
> 
> Eric
> 


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


Mime
View raw message