Saturday, May 7, 2016

Continues Inspection with SonarQube / Sonar plugins Part 4

Sonar Plugin Installation and Configuration for Eclipse IDE

Part 1 Part 2 > Part 3  >  Part 4

It is important to have at-least one project appearing in the SonarQube server's dashboard before staring this section.
(If you do not have projects in your SonarQube server, please follow the Part 2 - Continues Inspection With Sonar of this Article)

SonarLint Plugin



  • This plugin is also available on the eclipse market place
  • You can visit market place and drag/drop the "install" button to  your eclipse IDE. (It will start the installation process for you)

  • Or else inside the eclipse IDE goto "Help" > "Eclipse Marketplace"



  • Type "sonarlint" in the Find: section of the Eclipse Market place and hit enter. 
  • When search result appears, click on the "Install" button.

  • When "Confirm Selected Features screen" appears, select "SonarLint for Eclipse" and "SonarLint for Eclipse Java Configuration Helper" 
  • Then click the Confirm button.



  • When "Review Licence" screen appears select "I accept the terms of the license agreement" radio button and click on the Finish button.

  • Eclipse will continue the SonarLint plugin installation.
  • When it asks to restart the IDE to finish installation, allow it to do so.
  • Once eclipse restarts, create a sample Java project and a sample project as shown below.
CoreJavaDemo (Project)
     |--MySonar (Package)
              |--HelloWorld.java (Class)


  • Right click on the project and select "SonarLint" > "Bind to a SonarQube project"


  • When "Bind Eclipse projects to SonarQube projects" screen opens, select Eclipse project (CoreJavaDemos) and Type a SonarQube project name (which is already existing in SonarQube Dashboard)


  • If "Select a SonarQube server:" dropdown list does not have the localhost as a value, you should configure it with following values. To check whether the server is accessible, click on "Test server" button after providing the below details.
Server name : http://localhost:9000/
User : admin
Password : admin

  • Finally goto "Window" > "Show View" and select "SonarLint Issues" view


  • Now you SonarLint plugin will analyze the source-code which is being developed in the eclipse project and notify issues in real-time. (A Summary of issues will be displayed in SonarLint issues view)





5 comments:

  1. This is very useful
    Thanks for sharing. :)

    ReplyDelete
  2. You are welcome Sahan! It's a pleasure.

    ReplyDelete
  3. when I try SonarQube project, it keep saying that No results, Auto binding, giving me Auto-bind failed. Is this because I am using evaluation version only?

    ReplyDelete
    Replies
    1. Please refer to the information given in the accepted answer in this question,
      https://stackoverflow.com/questions/47175363/sonarlint-issues-shown-in-eclipse-not-in-bind-sonarqube-project

      Delete
  4. Hi, sorry for the late reply. Please mention the name+version of the plugin/sonarqube you have used.

    ReplyDelete

Things to be learned before learning Load Balancing

Network Layers (Keep in mind when working with diffrent protocols) Difference between HTTPS and SSL SSL (Secure Socket Layer...