1
votes

We have a central Sonar server for scanning and reporting on all the code within the organization. We also have the Sonar plugin for Eclipse (RTC) so that we can run local analysis as we edit code.

The problem I've got is that I need to set exclusions on 3rd party libraries so they don't get parsed when running a local analysis. I've seen how to set exclusions on the server but I don't have permissions to alter the server setup (and don't see the need to do this for a local analysis). I also don't have a local Sonar server running on my dev computer so I can't point the plugin to a server other than our central instance.

So the question is how do I set exclusions specifically for my local analysis without a local sonar server (e.g. localhost:9000)? Do I need to create a properties file, set an XML file, etc? If so then where do I put it so that the plugin picks up the exclusions? I tried setting a properties file in the root of the project folder with the syntax:

exclusions=/[projectRootFolder]/src/main/java/com/**/*.java

But the code in that folder structure still gets parsed.

1
The Eclipse Sonar plugin will pick up all the project settings from the server, so you should try and set exclusions there. - Mark O'Connor
@MarkO'Connor - thanks but, as stated, I don't have access to change the settings on the Sonar server. I was hoping that there was a way to override them for local scans when a local server is not present. I can't install a local server do to privileges on the box as set by the corporate owner. - Chris Swearingen
Understood, I saw that in your post, but, the Eclipse plugin is designed to pull it's configuration from your project in Sonar. Without it users are forced to locally configure the various tools like PMD, Findbugs, etc. - Mark O'Connor

1 Answers

0
votes

The Sonar Eclipse plugin is designed to centralise the configuration of the source code analysis tools you are running.

A question one must ask is why do you want to run a different analysis locally? Normally users want to execute the same analysis on the files in the local Eclipse workspace, before committing them into the shared code stream.

Finally, assuming you are using Maven it is possible to configure PMD, Checkstyle and Findbugs to run using their standard Maven plugins. In order to sync with Sonar you could download each tool's XML configuration. The following is an example of the "Sonar way with Findbugs" profile from Nemo: