Java 使用gradle和bootRun运行spring启动应用程序,并使用参数

Java 使用gradle和bootRun运行spring启动应用程序,并使用参数,java,spring-boot,gradle,build.gradle,Java,Spring Boot,Gradle,Build.gradle,我在build.gradle中有以下片段 buildscript { ext { springBootVersion = '1.5.12.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersi

我在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用于项目属性。

使用您拥有的配置,这应该可以:

./gradlew bootRun -Dserver.port=8090
使用这段代码:

bootRun {
   systemProperties = System.properties
}

System
属性传递给将要运行的应用程序<代码>-P用于项目属性。

与datasource和server.contextpath的方法相同?与datasource和server.contextpath的方法相同?