Skip to Content

Sonar comes with a killer feature: Eclipse integration. This does not only mean that there is an Eclipse perspective available, but Sonar findings can be used with Mylyn.

Sonar perspective

To make use of the Sonar perspective, the Java project needs to be linked to the Sonar project.

/wp-content/uploads/2012/04/sonar2_1_94982.jpg

Associate project with Sonar project

/wp-content/uploads/2012/04/sonar2_2_94983.jpg

Select Sonar project

Now the Eclipse Sonar plugin is reading the identified issues from the Sonar server and integrates them in the editor view. Clicking on the item in the right opens – like any other Eclipse message – a window and shows possible solutions.

/wp-content/uploads/2012/04/sonar2_3_94984.jpg

The developer can now act on the violations inside Eclipse without needing to logon to the Sonar server and find there the violations for the source code he is working on.

Mylyn integration

Assume that besides the actual developers you have a code quality or coordination group that analyzes code and uses Sonar for doing so. Now Sonar shows all these violations, errors, bugs and so on, but how to communicate to the developer that he has to act on the violation? Or to guide him with documentation or how to find out why the code is written like it is? Mylyn can be used to enable that kind of collaboration. The Sonar web interface allows creating for every violation to add a comment and assign the violation to a specific user.

/wp-content/uploads/2012/04/sonar2_4_94985.jpg

Sonar web interface

This review was created with the id #30 assigned to it. After configuring Mylyn to work in Eclipse together with Sonar, the review shows up under this id in the task list:

/wp-content/uploads/2012/04/sonar2_5_94986.jpg

Opening the task reveals the tasks information:

/wp-content/uploads/2012/04/sonar2_6_94987.jpg

Without leaving Eclipse the developer can act on the violations assigned to him. A special feature is the ability to click on the resource link in the tasks and Eclipse will open the corresponding file automatically. The developer can mark the task as solved from within Eclipse and the task will get updated. This change is visible immediately and does not require a new code analysis by Sonar.

/wp-content/uploads/2012/04/sonar2_8_94989.jpg

Using Eclipse brings a major benefit: plugins and an eco-system. Unfortunately, SAP decides to not make their Eclipse plugins easily accessible via the update functionality, but other software vendors are not as restrictive, transforming Eclipse into a productivity tool for Java developers, making it possible to integrate it into a Java developer landscape. One can only hope that ABAP for Eclipse won’t get a second NWDS.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Swapnil Shelke

    Hi Tobias,

    I am trying to integrate SonarQube with NWDS 7.3 but not able to update NWDS (i.e. plugins) from http://dist.sonar-ide.codehaus.org/eclipse.

    Download is not complete and NWDS shows below error message:

    Cannot complete the install because one or more required items could not be found.

      Software being installed: Sonar Java Analyser 3.2.0.20130627-1142-RELEASE (org.sonar.ide.eclipse.jdt.feature.feature.group 3.2.0.20130627-1142-RELEASE)

      Missing requirement: Sonar Java Analyser 3.2.0.20130627-1142-RELEASE (org.sonar.ide.eclipse.jdt.feature.feature.group n3.2.0.20130627-1142-RELEASE) requires ‘org.eclipse.platform.feature.group 3.6.0’ but it could not be found

    I could succeed to integrate it in Eclipse 3.5 kepler but not in NWDS 7.3.

    Can you please help me in this?

    Regards,

    Swapnil S. Shelke

    (0) 
      1. Swapnil Shelke

        Ok
        Now I’ve downloaded the Eclipse SDK and configured the SonarQube with it. I have imported the FileSystem in current workspace from NWDS workspace. I have configured the Sonar Runner locally & I could test manually with Sonar Runner some projects.
        But with eclipse I can’t.

        Any usggestions appreciated.

        Is there any other review tool which is compatible with NWDS 7.3 and from open source community?

        Thanks for your quick reply.

        (0) 
        1. Tobias Hofmann Post author

          For Eclipse and Sonar I suggest you check with the SonarQube homepage. Depending on what you develop, NWDS is not needed. Maybe you can switch over to Eclipse. This will give you more review tool options.

          (0) 

Leave a Reply