Spring-boot – how to set spring active profile environment variable in IntelliJ

intellij-ideamavenspring-boot

I am using spring boot application (maven project) in eclipse. When I run test clean target of maven project, I want to load the active profiles

I have added the property spring.profiles.active=test,aop in application.properties and also in application-test.properties, this does not have any affect.

or setting this property in command line option of IntelliJ IDE as -Dspring.profiles.active=test,aop does not have an effect when the command is test clean. I have also tried setting the JVM argument of the Runner in Intelligent

however @ActiveProfiles("test") works when the test case class is executed from IntelliJ IDE( right click -> run TestCaseClass).

Any clues ?

Best Answer

Setting the VM Options with -Dspring.profiles.active=test

enter image description here

enter image description here