André Martins
03/22/2024, 6:00 PMgradle bootRun -Dspring.profiles.active=local
the profile is not set, it only works if I set env var like SPRING_PROFILES_ACTIVE=local gradle bootRun
why is that? Does -D<prop>=<value>
not work with Kotlin DSL?Eric Haag
03/22/2024, 6:14 PM-D
option only passes a system property to the JVM that is running Gradle, not to any of the invoked tasks.
https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_system_properties
If you want to specify the profile from the Gradle command line you will have to wire a Gradle property to add the system property to the bootRun
task.
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html#org.gradle.api.tasks.JavaExec:systemProperties(java.util.Map)Anze Sodja
03/22/2024, 6:49 PM./gradlew bootRun --args='--spring.profiles.active=local'
And below that it's also an example how to pass system properties to bootRun.