Today I faced an interesting issue. One of my unit tests passed on my local machine and it failed on our Jenkins server. So I decided to debug the unit test remotely to understand what the problem was. As Jenkins reference mentions you can use the typical
setting to enable remote debug when starting a job on Jenkins. However, if you take a look at Maven Surefire’s page on debugging tests it has a bit slightly different usage that you should use
-Dmaven.surefire.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE
to enable remote debugging. To get this working with Jenkins, you should note that you should provide Surefire’s setting on
Goal option of “Build” section of the job configuration page. If you do it on
MAVEN_OPTS in the advanced section of the job build section, eclipse will not be able to get the breakpoints.