the easiest way to pass spring profiles to gradle bootRun
is (for me) by environment variable (e.g. SPRING_PROFILES_ACTIVE
), when run on commandline.>
I've had success adding the following to my build.gradle file:
tasks.withType(org.springframework.boot.gradle.run.BootRunTask) {
systemProperty('spring.profiles.active', 'local')
}
This allows gradlew bootRun
to be run from IntelliJ without requiring any changes to the IntelliJ Run/Debug Configurations (and also from the command line without having to manually specify a profile).