• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best Practices - Properties files

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the best practice for maintaining different versions of properties files like for prod, test and dev and generate war/ear out of it selecting correct version of property file using Ant?

What I have done is I have kept all three version of properties file together with .prod and .test suffix for Production and Test, and for Development just .properties. In my Ant I have written three different targets and I am coping and renaming appropriate property file.

I use RAD7 and Websphere.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many ways to solve this problem, your method is a reasonable one. Another approach is to pass in an environment variable via the command line e.g. ant -Denv=dev and then use that to pick out the correct properties file ${env}.properties .
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I prefer not to make different builds for test/dev/prod. The problem with doing so is that if the production app goes down, you may have trouble keeping track of the different versions, and in some cases, the program code itself may even be different.

I get around this by creating a universal deployable and injecting the configuration information in on a per-server basis - typically via JNDI.

A side benefit of this is that if I need to do before and after comparisons, I can usually run 2 copies of the app on a single test machine just by deploying them with different contexts and configurations.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Actually, I prefer not to make different builds for test/dev/prod.


Me too. I use different sets of property files so I just have to change the classpath of the app for the environment. (And of course other settings are in JNDI.)

I generate my property files since we have many environments. So I really only maintain one set of property files and another file with the differences.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic