Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven appassembler : Moving properties files to conf folder at build time

 
Amirr Rafique
Ranch Hand
Posts: 324
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

To load environment specific values, in my src/main/resources folder, I have some properties files in different subfolders i.e.

com/app/ws/webservices-dev.properties
com/app/ws/webservices-test.properties
com/app/jms/jms-dev.properties
com/app/jms/jms-test.properties
I am loading these properties through spring

ENVIRONMENT is environment variable.

I am using appassembler-maven-plugin to generate the executable .sh file.

As a result of this all my properties files become part of my generated jar file. I want to expose some of the properties to set their values at deployment time. I have tried following configuration

But Spring does not load the properties; may be due to the given path in spring config(see above) ?

What maven configuration should I use to move my properties files in appassembler\conf folder at package time and have spring load them from classpath. I am after the configuration that works for both development(in eclipse, unit tests as maven builds) and in deployment

Please guide.

Thanks
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your first step is to verify that the classpath is being set as you expected, and that the properties files are in the conf directory. Also, you do know that the properties files need the full package/path name, right? In other words, you should see, for example "conf/com/app/ws/webservices-dev.properties".

Just a guess, by I think that the <configurationSourceDirectory> should be just src/main/resources, otherwise you will loose the package/path name on the files.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic