[英]Run spring boot app with gradle with bootRun using arguments
我在build.gradle中有以下片段。
buildscript {
ext {
springBootVersion = '1.5.12.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
..
bootRun {
systemProperties = System.properties
}
..
我使用以下命令運行該應用程序。
./gradlew bootRun -PjvmArgs=-Dserver.port=8090
但是,它不起作用。 我應該如何更改以指定的端口運行應用程序,就像我在application.properties中所做的那樣。
server.port=8090
使用配置,您應該可以正常工作:
./gradlew bootRun -Dserver.port=8090
使用這段代碼:
bootRun {
systemProperties = System.properties
}
您將System
屬性傳遞給將要運行的應用程序。 -P
用於項目屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.