How to run bootRun with spring profile via gradle task

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

    Kotlin edition: Define the following task in you build.gradle.kts file:

    tasks.named("bootRun") {
      args("--spring.profiles.active=dev")
    }
    

    This will pass the parameter --spring.profiles.active=dev to bootRun, where the profile name is dev in this case.

    Every time you run gradle bootRun the profile dev is used.

提交回复
热议问题