0
votes

I have a project which is built by Jenkins. I have installed the Jenkins SonarQube plugin, and added a build step to run the Sonar analysis.

This works fine, and issues are appearing in my Sonar dashboard correctly.

I have written some custom Findbugs rules, and I would like to add them to this analysis. I have written a Findbugs plugin (which I have tested using the Findbugs standalone runner), and I have written a Sonar plugin which wraps the Findbugs plugin (based on the fb-contrib sonar plugin).

I have installed my Sonar plugin on my Sonar server (at /opt/sonar/extensions/plugins), but it does not affect the Jenkins build.

I have looked at the Jenkins configuration for the Jenkins SonarQube plugin, and one of the options is where Sonar should be installed from. It is currently set to install Sonar from "maven". There are no options which appear to affect which Sonar plugins will be used.

How can I get my custom Findbugs rules into this toolchain?

1
Have you added your custom FindBugs rules to your quality profile? And can you add them to the quality profile (i.e. do they appear in the selection)? - barfuin
That did it, thanks -- they had appeared in Sonar, and were disabled. After enabling them in the sonar quality profile, they have now started appearing in subsequent builds. So the Jenkins Sonar client must download my plugin JAR from the server somehow. Thanks very much. If you convert your comment to an answer, I'll accept it. - Rich
I also wrote a finbugs plugin and looking to integrate it with SonarQube. How exactly you did that ? Where did you places the plugin jar ? and what xml files you changed to make sonar aware of the new rules ? - Vasile

1 Answers

1
votes

Make sure that you have added your custom FindBugs rules to your quality profile. If you can't add them to the profile, then the plugin is not loading correctly. But maybe you just need to activate the new rules in the quality profile.