How to run bootRun with spring profile via gradle task

前端 未结 13 1425
误落风尘
误落风尘 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:52

    In your build.gradle file simply use the following snippet

    bootRun {
      args = ["--spring.profiles.active=${project.properties['profile'] ?: 'prod'}"]
    }
    

    And then run following command to use dev profile:

    ./gradlew bootRun -Pprofile=dev
    

提交回复
热议问题