Sonar-runner debugging

143 views
Skip to first unread message

anand sudhan

unread,
Nov 3, 2016, 10:53:08 AM11/3/16
to SonarQube

I tried to debug sonar-runner 2.4 by following these steps:

i)  set SONAR_RUNNER_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" ;
ii) cd to project directory
iii) sonar-runner -X -e

I am unable to attach to debugger instance of sonar-runner via the IDE. It just seems like sonar-runner has a normal execution.
Am I missing something? ( I know how to debug the SQ server and also language plugins - I want to know how to debug and step into sonar-runner code)

Thanks!
Anand

Julien HENRY

unread,
Nov 7, 2016, 11:31:57 AM11/7/16
to SonarQube
Hi Anand,

This should work (we are using this all the time). Maybe you should try with a more recent version of the SonarQube Scanner (2.8 was released recently).

++

Julien

anand sudhan

unread,
Nov 7, 2016, 2:03:13 PM11/7/16
to SonarQube
Thanks Julien. I am able to debug with 2.8 sonar-scanner with SONAR_SCANNER_OPTS set.
I think earlier I  might have reused the same port number for SQ server and sonar-runner debugger - and hence I wasnt able to latch on the runner in debugging mode.

Regards,
Anand

anand sudhan

unread,
Nov 18, 2016, 4:36:50 PM11/18/16
to SonarQube
I found the debugging behavior for both sonar-runner and sonar-scanner to be very erratic. (As in, successful sometimes but not always).

As mentioned above I was using Sonar-Runner/Sonar-Scanner version 2.8. 
I use Windows 7 .
I do:  set SONAR_RUNNER_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" 
and   set SONAR_SCANNER_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"

But then I dont always end up in debugging mode. I found this post in SO talking about weird behavior with USER variables in Windows.
So the workaround for the issue is to set the System variables - whenever you want to debug. 
Of course, one will have to delete the system variable after debugging is done.
Reply all
Reply to author
Forward
0 new messages