Lesha Pipiev
Lesha Pipiev

Reputation: 3333

Gradle bootRun not working with SPRING_PROFILES_ACTIVE but works with spring.profiles.active

MacOS Monterey.
Spring Boot 2.4.5.
Gradle 7.4.2

The question is pretty simple.

This one doesn't work:

SPRING_PROFILES_ACTIVE=local ./gradlew bootRun 

This one works:

./gradlew bootRun --args='--spring.profiles.active=local'

Under "works", I understand that the profile is being successfully passed to Gradle task.

What I have read is that SPRING_PROFILES_ACTIVE - is OS environment variable, while spring.profiles.active is System property.

Still not clear why the option SPRING_PROFILES_ACTIVE=local ./gradlew bootRun doesn't work.

Thank you.

Upvotes: 0

Views: 1691

Answers (1)

shazin
shazin

Reputation: 21923

Break this into multiple lines

$ export SPRING_PROFILES_ACTIVE=local 
$ ./gradlew bootRun 

Upvotes: 1

Related Questions