'Debugging maven tests with IntelliJ

I've read multiple variants of this question (sorry for adding another), but none have offered a working solution.

I am trying to debug a failing test in the application thingsboard. I can reproduce the problem at the command line with:

mvn test -Dlicense.skip=true -DfailIfNoTests=false -Dtest=MqttNoSqlTestSuite

When I change the "mvn" to "mvndebug", I see the following message at my terminal:

Listening for transport dt_socket at address: 8000

Inside IntelliJ, I click the debug button, and my IntelliJ console says:

Connected to the target VM, address: 'localhost:8000', transport: 'socket'

and the command line process starts running.

So far, so good.

The problem is that none of my breakpoints get hit, even ones attached to lines that print a message to the console, so I can be positive are being executed.

I have tried multiple variants of the command line, including just about every permutation of the following flags:

-DforkCount=0 -DreuseForks=false -DforkMode=never

I'm just stuck. Any idea how I can get IntelliJ to halt the running code at a breakpoint?



Solution 1:[1]

for me once you put in command line -Dmaven.surefire.debug i go in top menu, run => attach to process, then i choose my process with the good port and all goes well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cyril