How to: Gradle Build spring boot app with external config file

荒凉一梦 提交于 2021-01-28 10:38:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!