IDEA not honoring maven surefire properties


We are using the built in Maven integration in IDEA. When we run certain TestNG tests, there are certain dependencies that we don't want to include on the test classpath. Currently, IntelliJ adds every projects' target/classes directory to the classpath when running the test, which is causing us some classloader issues. There is an additional configuration option in the surefire maven plugin that will allow a user to specify certain dependencies they want to ignore when running the test, called "classpathDependencyExcludes". It looks like IntelliJ is ignoring this flag. Is there any way to honor this flag so we can run our unit tests from inside of IntelliJ? Thanks!



I also ran into this issue myself today. I need to remove some slf4j bindings that are in my classpath for testing purposes. Running mvn test command works fine, within intellij however, the dependency is not ignored.


I faced the same issue as above. Looks like this one has been open for years now. Is there a plan to fix it?


Please sign in to leave a comment.