In IntelliJ, how do i debug a maven test goal?

JavaRocky picture JavaRocky · Sep 24, 2010 · Viewed 48.3k times · Source

Using intellij and maven pom files, how do i debug tests run inside the maven test goal?

When i run them directly in the code, it complains something about profiles missing, which i've ticked inside intellij's Maven Projects.

Answer

Hover Ruan picture Hover Ruan · Jun 23, 2011

http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html

In IDEA, run your test in debug mode "mvn -DforkMode=never test"

Updated: Open your run/debug configuration, in "Runner" tab, add -DforkMode=never

enter image description here

(Noted by @mikeapr4: newer versions of the surefire plugin (2.14+) use mvn -DforkCount=0 test)