• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where is a good place to put application-wide properties files

 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be more of an ANT or deployment question, but I'll start here. If it belongs elsewhere, we can move the thread.


I've been putting assorted .properties files in the WEB-INF/classes directory, and it works fine.

But, I've checked in these files into SVN, and when a user does a checkout, they get the "standard" versions. And that may not be where we want to get them, or where they should be.

The problem is that I put lots of stuff in the properties, such as host name for SMTP servers, the Host and URL for JDBC, usernames for the "from" field of outgoing email notices, etc. When I'm developing, I usually want to use a non-production set of values. And I can see that the marketing folks might want a copy on their laptops to show in demos. Clearly "production" wants real values.

What's a clean way to handle this?

Thanks
pat
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I keep mine in a folder in the source tree and copy them to classes folder as part of the ant build. That way, they are not an svn issue.
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:I keep mine in a folder in the source tree and copy them to classes folder as part of the ant build.

But aren't all the files and folders in your source tree checked into SVN?

I was thinking of some hack where I look for a magic enviroment variable, something like PAT_CONFIG_HOME, and if its there, read from there, else let
the usual WAR/JAR rules hold. This feels like a hack.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you don't want the deployed version to be in svn?

My scenario allows local developers to keep their private versions in the classes folder without svn issues. The "official" version is what is in svn, and is copied into the war file for deployment.
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:So you don't want the deployed version to be in svn?

My scenario allows local developers to keep their private versions in the classes folder without svn issues. The "official" version is what is in svn, and is copied into the war file for deployment.


Of course, I want to have everything in svn, so I can install an OS, and svn, and pull everything out of the repository. And then a miracle occurs.

Perhaps I don't understand your approach. If the ant script is in svn, like mine is using netbeans, then the usual clean and build will get the usual "production" results.

Perhaps if you explained a bit more?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a million ways to handle this.

I usually end up with a hostname-based solution and/or a system property name-based one, either home-brewed or through a Spring-based PropertyPlaceholderConfigurator extension. We've always checked in developer-/host-specific files, although sometimes we've ended up with "local.properties"-like files that aren't under version control. I try to avoid that when possible.

YMMV.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's the "official" properties files in the source tree. When a developer is running a local copy, he copies them to his classes folder and makes any necessary local changes. These are not part of the source tree and so there is no danger of them getting checked in with local changes.

During a build, the "official" versions become part of the war file for deployment.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic