ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: How to best create environment specific properties in an applications property file using ANT
Date Tue, 27 Feb 2007 10:48:35 GMT
Eric Wood wrote:
> This is for a utility/tool called hibernate that we are incorporating into our application
and it uses a configuration file called hibernate.cfg.xml that I do not think that I can split.
> 
> I'm currently using the expandproperties filterread along with loadfile to load the environment
specific settings. I can't version the development copy because I haven't found an ANT way
to clip the section of the original file that contains the development environment setting
out before I load the other environment settings in.
> 
> Eric
> 

You are moving beyond build-time stuff here into the broader problem of 
configuration management; you are trying at build time to pick a 
specific target installation, because, as we all know, that is exactly 
what you have to do.

1.  keep the separate files under SCM and at build time pick between 
them. Create WAR/EAR files with specific names if you want to reduce the 
risk of accidentally deploying a test configuration to production site

2.  have one per host in the JAR and have it decide at run time which to 
use based on hostname or some system property.

3. Use one of the configuration management tools for java:
http://www.manageability.org/blog/stuff/configuration-deployment-frameworks-in-java/view

4. eliminate differences between test, staging and production systems by 
having vmware or xen images for testing that match those in production: 
same OS, /etc/hosts set up so even the hostnames of the db server match, 
etc etc.

Me, I use (4) and (3), though I've done #2 sometimes.

-Steve

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


Mime
View raw message