How to run bootRun with spring profile via gradle task

前端 未结 13 1379
误落风尘
误落风尘 2020-12-04 19:20

I\'m trying to set up gradle to launch the bootRun process with various spring profiles enabled.

My current bootRun configuration looks lik

13条回答
  •  攒了一身酷
    2020-12-04 19:49

    For anyone looking how to do this in Kotlin DSL, here's a working example for build.gradle.kts:

    tasks.register("bootRunDev") {
        group = "application"
        description = "Runs this project as a Spring Boot application with the dev profile"
        doFirst {
            tasks.bootRun.configure {
                systemProperty("spring.profiles.active", "dev")
            }
        }
        finalizedBy("bootRun")
    }
    

提交回复
热议问题