2

Using spring-boot-maven-plugin version 1.5.9.RELEASE. The documentation states using -Drun.profiles to activate the active profiles. But running on the command line the profile is not activated:

mvn spring-boot:run -Drun.profiles=development

Using the jvmArguments parameter works and the profile is active:

mvn spring-boot:run -Drun.jvmArguments="-Dspring.profiles.active=development"

Reference: https://github.com/spring-projects/spring-boot/issues/1095

Update:

It turned out, that the profile had been loaded correctly. Only the logging was disabled due to a conditional configuration of Logback:

In the Logback configuration I used a statement like <if condition='property("spring.profiles.active").contains("development")'>. Using the Maven plugin with -Drun.profiles does not set the system property spring.profiles.active but sets the command-line argument (--spring.profiles.active).

So, when using conditional statements in Logback only system properties and environment variables can be used.

timomeinen
  • 3,101
  • 3
  • 33
  • 46

1 Answers1

1

Ensure do you have application-development.properties file. Else create it and put your properties there. By default application.properties will be considered and executed.

Based on the profile, you have create corresponding application properties file.

Hussain
  • 915
  • 6
  • 11