Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
titleTable of Contents

Table of Contents

Local and Remote Mode

When using Sonar in Eclipse, 2 modes are available:

Remote Mode

This is the default mode. Information showed in the remote mode is coming from a remote Sonar server. This means that those information have been computed during the latest analysis on that server.


  • You will not see violations introduced in the code that you just added.
  • Metrics (number of lines for example) will display values that will not match what you see in Eclipse if you added some code.

Local Mode

When switching to the local mode, information displayed is coming from the latest local analysis.


  • You can see violations introduced in the code that you just added.
  • Metrics (number of lines for example) will display values that will match what you see in Eclipse if you added some code.

Switch from One Mode to Another

To switch from one mode to another, right-click on the project, then select Sonar > Mode > Remote or Local:

Image Removed

Features below will be tagged as Remote or/and Local depending on their availability.

The Sonar Eclipse Perspective

Sonar Eclipse provides one Eclipse perspective and four Eclipse views. Those Eclipse views can of course be used outside the Sonar Eclipse perspective, but this tutorial describes the default Sonar Eclipse perspective layout.

To activate the Sonar Eclipse perspective, click on Windows => Open Perspective => Other... and select Sonar:

Image Removed

The Measures View (Remote and Local)

The Measures view allows to gather all available measures on the selected ressource. Most of the time, developers focus their attention on only a few metrics like complexity, uncovered lines of code by unit tests, duplicated lines, etc. and want to get a quick overview on those metrics. That's why favourite metrics are displayed on the top of the Measures view. Adding or removing a metric from the Favourites list is possible by right clicking on the metric name:

Image Removed

The Violations View (Remote and Local)

The Violations view displays the list of violations of the selected resource (project, file, etc.):

Image Removed

The Hotspots View (Remote)

The Hotspots view allows to quickly identify hotspots on files according to favourite metrics (defined in the Measures view). You can for instance look at files with the greatest number of duplicated lines, the greatest number of violations, the greatest number of uncovered lines by unit tests, etc.

Image Removed

The Web View (Remote)

The Web view displays the web Sonar dashboard (for projects and packages) or the web Sonar ressource viewer (for files). This web page can be used to access information and services (cloud, treemap, ...) that are not yet natively available in Sonar Eclipse:

Image Removed



While browsing the source code, SonarQube in Eclipse highlights issues. But its added value is to be able highlight the new issues that you have introduced while adding/modifying the source code. You can thus check your code prior to pushing it to the SCM to make sure that you haven't introduced any new issues.

Running an Analysis

To run a new analysis, right click on your project and go to SonarQube > Analyze. You can also hit Ctrl+Alt+Q wherever you are in your project to trigger a new analysis.

Image Added

By default, the analysis mode is incremental. Because only new/modified files are checked, you get feedback and the list of new issues very quickly.

Note that you can also run an analysis on a working set. This allows you to trigger several analyses at once on all the projects of the working set.

Include Page
Include - Local Analysis Notes
Include - Local Analysis Notes

Analysis Parameters

Parameters are retrieved as defined below:

  • Parameters defined in the SonarQube Web UI
  • Parameters set in the pom.xml file (for Maven projects only, with the m2e connector installed) will override parameters defined in the UI
  • Parameters defined in Eclipse will override  parameters defined in the pom file (go to Window > Preferences > SonarQube > Preview analysis properties)
  • Parameters defined at project level in Eclipse will override parameters defined at Eclipse level (right click on the project and go to Properties > SonarQube > Preview analysis properties)
titleExcluding Plugins

Some plugins (useless for a preview analysis) can be skipped thanks to the sonar.preview.excludePlugins (was sonar.dryRun.excludePlugins prior to SonarQube 4.0) property. This property can be set through the SonarQube web interface: Settings > General Settings > General > General).

The default value is "devcockpit,pdfreport,report,scmactivity,views,jira". For example, to skip the Build Stability plugin (due to, set the property to edevcockpit,pdfreport,report,scmactivity,views,jira,buildstability".

Last Analysis Date

There are two ways to know when the last analysis was run on a project:

  • Right-click on the project in the Project Explorer, and then Properties > SonarQube
  • This date can be displayed on the navigation views, like the Project explorer or the Navigator. This option is not active by default. To activate it, go to Window > Preferences > General > Appearance > Label Decorations and check SonarQube Analysis Date Decorator:

Image Added

Browsing the Issues

Four different views are available to browse the quality of your projects:

  • SonarQube Issues that list the issues on the selected component
  • SonarQube Issue Editor to review the issue
  • SonarQube Rule Description to get the detailed description of the rule that is violated
  • SonarQube Web Browser

Image Added

SonarQube Issues

The SonarQube Issues view displays the list of issues of the selected component (project, module, file, etc.). To display this view, go to Window > Show View > Other... > SonarQube > SonarQube IssuesProblems and Markers views also display issues.

Issues are flagged in the source code viewer. New issues (compared to the latest version on the SonarQube server) are highlighted in yellow. This allows you to focus on the new issues that you have introduced.

Image Added

You can add/remove/order columns, group issues (by severity, new issues only, ...), filter issues (new issues only, issues assigned to me, ...), sort (by assignee, ...).

Note that "Resolved" issues are not displayed.

SonarQube Issue Editor

This view allows you to review the selected issue (add comments, confirm it, plan it, etc.) the same way you would do it through the web interface. To display this view, go to Window > Show View > Other... > SonarQube > SonarQube Issue Editor.

Image Added

Note that it is not possible to review new issue that you have introduced.

SonarQube Rule Description

This view allows you to access the detailed description of the coding rule of the selected issue. To display this view, go to Window > Show View > Other... > SonarQube > SonarQube Rule Description.

Image Added

SonarQube Web Browser

This view allows you to access the SonarQube web interface. This view is automatically displayed when clicking on SonarQube > Open in SonarQube server. It can also be displayed by going to Window > Show View > Other... > Sonar > Sonar Web Browser.

 Image Added


No issues are displayed

It happens when the source folders are not properly set in Eclipse.

Let's take the C/C++ project sample for instance. When you import it into Eclipse, by default the source folder is set to /cpp-sonar-runner (and not to /cpp-sonar-runner/src):

Image Added

Therefore, SonarQube will try to retrieve data from files whose fully qualified names are src/, src/HelloWorld.cpp, etc. It will find none as the fully qualified names in SonarQube are, HelloWorld.cpp, etc. (without "src/"):

Image Added

Hence, you won't get any issue displayed in remote mode in Eclipse.

But if you set the source folder to cpp-sonar-runner/src instead:

Image Added

you will get issues displayed:

Image Added