Here's a consolidated list of debugging techniques to use during SonarQube-related development.
Debugging a plugin during sonar-runner analysis
- Copy your plugin's jar file to SONAR_HOME/extensions/plugins
- Start SonarQube normally, (debug is commented out in wrapper.config)
- At a command prompt, cd to the directory of the project you'll be analyzing
Start sonar-runner in debug mode with the following commands
Attach the IDE to the debug process on port 8000, set breakpoints in the source, and debug!
Debugging a plugin during Maven analysis
mvnDebug sonar:sonar and attach your IDE to the remote process. Example in Intellij Idea: Run > Edit configurations > Add new configuration > Remote.
Debugging a plugin server-side
- Copy your plugin's jar file to extensions/plugins
- Edit SONAR_HOME/conf/wrapper.conf and uncomment the line : wrapper.java.additional.3=-agentlib:jdwp=transport=dt_socket,server=y,address=8000
- Launch SonarQube normally. The following line will appear in the log : Listening for transport dt_socket at address: 8000
- Attach the IDE to the debug process on port 8000, set breakpoints in the source, and debug!