java - How to provide Maven project properties as a service? -


context

i have maven module (let's call service). uses spring-boot (non-web environment) @configurationproperties load configuration 1 or more .properties files. on runtime configuration stored in singleton class myconfiguration.java getters known properties.

the goal have other modules / projects (let's call apps) have individual .properties file , use service automatically populate configuration. further, service exports via src/main/resources root-settings.properties contains placeholders project properties required apps.
these should populated via maven filtering mechanism derived project properties based on pom.xml

one such property version. in service test verifies replaced maven following setup:

root-settings.properties

applicationversion=${project.version}

pom.xml

<build>   <testresources>     <testresource>       <directory>src/test/resources</directory>       <filtering>true</filtering>     </testresource>   </testresources> </build> 

question

how configure or re-design services single dependency apps , call myconfiguration.getinstance().getapplicationversion() provides version of apps?

as stands, when apps has dependency on service root-settings.properties shown above present in classpath. there still 2 problems:

  • ${project.version} not replaced during resource filtering because root-settings.properties in external .jar. need configure goal unpack .jar , hope resource filtering apply afterwards.
  • each app need add resource filtering configuration making use of services less convenient. looking solution in best case not need modification of apps pom.xml

related questions
in order of relevance these 2 topics related:
- maven filtering on resources stored in dependencies
- filter maven resources filter-file external dependency


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -