aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven appassembler : Moving properties files to conf folder at build time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven appassembler : Moving properties files to conf folder at build time" Watch "Maven appassembler : Moving properties files to conf folder at build time" New topic
Author

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

Amirr Rafique
Ranch Hand

Joined: Nov 14, 2005
Posts: 324
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

"Know where to find the solution and how to use it - that's the secret of success."
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

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.


JBoss In Action
 
 
subject: Maven appassembler : Moving properties files to conf folder at build time