Search code examples
javamavenjunitintellij-idea

How can I run the IntelliJ debugger on unit tests in a Maven project?


I'm working with a multi-artifact Maven project where artifacts in the project have a few dependencies on each other. I am using IntelliJ 9. I'd like to be able to set breakpoints in my unit tests, but when I right-click on the unit tests folder for my artifact and choose "Debug 'All Tests'", I get a Class not found exception referring to a class in a separate Maven artifact.

I can run the Maven "test" goal on the parent artifact and it works fine.

Any ideas? Thanks.


Solution

  • I wanted to run the unit tests for a specific package.

    I was able to get this to work by making a new JUnit run/debug configuration in IntelliJ. I told it to run the tests in the specific package and for "Use classpath and JDK of module", I picked the root Maven artifact.