Improperly parsing environment variables in pom.xml

we have a simple system property set in our pom.xml


when running maven on the command line, or within eclipse, since the SPRING_PROFILES_ACTIVE environment variable is not set, it gets substituted to a bland string ""

when importing the project into IntelliJ, intelliJ will set the system property to the value "${SPRING_PROFILES_ACTIVE}" and in our case, it will then cause spring to think it is an expression and yield

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'SPRING_PROFILES_ACTIVE' in string value [${SPRING_PROFILES_ACTIVE}]

Now, the work around is simple, we can either set the environment variable or we can configure as a VM option in the run configurations. However, it feels like the correct thing would have been to mimic the Maven behavior properly.

any thoughts? is this an issue?

thanks in advance for your time


Comment actions Permalink


Where do you have this systemPropertyVariables in your pom.xml?

What goal (or any other action) fails in IDEA?

Thank you,

Comment actions Permalink

You can see the variable definition here

and the project, all I did was import the
into IntelliJ.

No goals fail, but when I run any unit test, IntelliJ sets the to "${...}" instead of resolving the variable to empty ""

Comment actions Permalink

Thank you.

And what does fail? I've run a surefire goal from Maven tool window, it goes with no error.


Comment actions Permalink

Any test that depends on IntelliJ to properly resolve variables will fail.

Here is a simple reproducible test

1. git clone
2. cd idea/my-app
3. mvn test

Step 3 'mvn test' here succeeds.

4. Now import this project into IntelliJ,
5. Locate the class AppTest
6. Right Click on AppTest and Select Run

Step 6 - this test fails.

Import the project into eclipse, and the test succeeds.

The bug in intellij is that it doesn't properly do variable substitution.
the command line for the unit test becomes

/software/java/jdk1.7.0_51_x64/bin/java -ea${SPRING_PROFILES_ACTIVE} -Didea.launcher.port=7532 -Didea.launcher.bin.path=

as you can see, it did not properly set the system property to an empty value.


Please sign in to leave a comment.