How to run bootRun with spring profile via gradle task

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

    Environment variables can be used to set spring properties as described in the documentation. So, to set the active profiles (spring.profiles.active) you can use the following code on Unix systems:

    SPRING_PROFILES_ACTIVE=test gradle clean bootRun
    

    And on Windows you can use:

    SET SPRING_PROFILES_ACTIVE=test
    gradle clean bootRun
    

提交回复
热议问题