• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You've gotta fight it! Don't give in! Read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic