We have a spring boot app with externalized configuration in a properties file. Executing the jar file like so works:
java -jar -Dspring.config.location="application.properties" app.jar
Executing the jar directly like below works, but without the properties file. Right now, none of these options below take the properties file.
./app.jar
./app.jar -Dspring.config.location="file:./application.properties"
I was hoping we could do something in the pom.xml or in the command that executes to achieve this.
FYI, we have this plugin in the pom.xml to build us the jar file:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<includeSystemScope>true</includeSystemScope>
<!-- This below does not work -->
<!-- <jvmArguments> -->
<!-- -Dspring.config.location=application.properties -->
<!-- </jvmArguments> -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>