Running JUnit tests in IDEA does not respect configured System Properties or argLine of maven-surefire-plugin

Answered

In the configuration of my Maven Surefire Plugin there's a system property being set:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <! -- <argLine>-Dslf4j.provider=ch.qos.logback.classic.spi.LogbackServiceProvider</argLine> -->
                    <systemPropertyVariables>
                        <!-- Suppress warning "Class path contains multiple SLF4J providers" which is caused by bundled SimpleServiceProvider in Maven -->
                        <slf4j.provider>ch.qos.logback.classic.spi.LogbackServiceProvider</slf4j.provider>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

When I run mvn test from the Maven tool window this works as expected.

However, when running a single Test class (e. g. with Ctrl + Shift + F10), the configured system property is not applied - which I notice from warnings during the execution of the test.

In my project's settings, Maven - Running Tests, I have activated all checkboxes for lineArg, System Properties and  Environment Variables.
Having that said, when I enable argLine in my POM, this isn't applied also. 

            

0
2 comments

Hello, Peter!

Thank you for reporting this!

This appears to be a known issue described in IDEA-159973 - please make sure to upvote it to raise its' priority for the developers.

0

Thanks Roman for pointing this out. I didn't find that issue via Google.

0

Please sign in to leave a comment.