I know I’m late here… but I recently faced this exact issue. I was trying to launch bootRun with spring.profiles.active and spring.config.location set as system properties on the command line.
So, to get your command line “magic” to work, simply add this to your build.gradle
bootRun {
systemProperties System.properties
}
Then running from the command line…
gradle -Dspring.profiles.active=local bootRun
Will set local as the active profile, without needing to define a separate task simply to add the env variable.