问题
Maven way is very simple:
mvn clean install -Dspring.config.location=/path/config.properties
How can I do this with Gradle?
回答1:
You should specify a task and add jvmArgs for running spring boot application in build.gradle file:
bootRun {
jvmArgs = ["-Dspring.config.location=/prop.properties"]
}
or run in command line:
gradle clean build bootRun -Drun.jvmArgs="-Dloader.config.location=/path/to/prop/file"
来源:https://stackoverflow.com/questions/52097929/how-to-gradle-build-spring-boot-app-with-external-config-file