Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java platform: How to manage Configuration Settings for each Developer

Inspired by this question:

How to manage Configuration Settings for each Developer

How can I manage application configuration settings that are must be set for each developer without checking them into source control on the Java platform?

For example, this is the kind of thing we are doing now:

  • Datasource configuration is stored in a Spring configuration xml file.

  • Currently, each developer edits the file and tries his best not to commit that file into source control. Several of us have patches (diff files) that are applied to the code before performing testing against our local database and remove the patch before checking code in. Other developers edit and revert the configuration files by hand.

  • Sadly, patches get out of date. People sometimes forget to revert their local configuration before commit.

My question, however, is not limited to database connection settings. I would like to find a solution where each developer can override application configuration settings without having to alter source controlled files.

If we must change the way in which we are storing configuration settings, then I think we should do it (perhaps JNDI?, external configuration files in a well known path?, I don't know)

What would you do/have you done?

like image 251
Sergio Acosta Avatar asked Jul 28 '10 10:07

Sergio Acosta


2 Answers

Place the configuration file in an external directory. If it is not present, read a default config file. The external directory can be configurable, and can have a default value, say c:\workspace\config.

Optionally, during the build, you can copy the external properties into the build artifact.

like image 63
Bozho Avatar answered Sep 30 '22 09:09

Bozho


We make the build completely self contained, including things like local H2/Hipersonic/JavaDB databases and Ruby mail servers. That means the local build has no developer specific config and everything just points to the pre-packaged components. It also means that apart from basics (JVM, Ruby, Editors) there is zero time to configure a developer box.

The drawback is that your code checkout is somewhat bigger.

like image 26
leonm Avatar answered Sep 30 '22 09:09

leonm