如何:使用外部配置文件构建Gradle Spring Boot应用 [英] How to: Gradle Build spring boot app with external config file
本文介绍了如何:使用外部配置文件构建Gradle Spring Boot应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Maven方法非常简单:
Maven way is very simple:
mvn clean install -Dspring.config.location=/path/config.properties
如何使用Gradle做到这一点?
How can I do this with Gradle?
推荐答案
您应该指定一个任务,并在build.gradle文件中添加jvmArgs以运行spring boot应用程序:
You should specify a task and add jvmArgs for running spring boot application in build.gradle file:
bootRun {
jvmArgs = ["-Dspring.config.location=/prop.properties"]
}
或在命令行中运行:
gradle clean build bootRun -Drun.jvmArgs="-Dloader.config.location=/path/to/prop/file"
这篇关于如何:使用外部配置文件构建Gradle Spring Boot应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文