How to pass system property to Gradle task

前端 未结 14 2552
别跟我提以往
别跟我提以往 2020-12-08 02:17

I\'m using Gradle spring-boot plugin and I need to select a spring active profile for the test run.

How do I pass spring.profiles.active sy

14条回答
  •  無奈伤痛
    2020-12-08 03:00

    Starting from SpringBoot 2.0.0-M5 setSystemProperties() is no longer a method of the task bootRun. The build.gradle needs to be updated to

    bootRun {
        execSpec {
            // System.properties["spring.profiles.active"]
           systemProperties System.properties
        }
    }
    

    This is as springBoot's run task uses org.gradle.process.JavaExecSpec

    This works for me using Gradle 4.2

提交回复
热议问题