Custom Search

Sunday, November 5, 2017

How to Setup Eclipse IDE for Sonar Analysis

1)
$ brew install sonar


Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
==> Downloading https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-5.6.zip
######################################################################## 100.0%
==> Caveats
To have launchd start sonar now and restart at login:
  brew services start sonar
Or, if you don't want/need a background service you can just run:
  sonar console
==> Summary
   /usr/local/Cellar/sonar/5.6: 1,882 files, 128.4M, built in 2 minutes 23 seconds

2)
$ sonar console


Running SonarQube...
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | 2017.11.05 12:54:24 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /usr/local/Cellar/sonar/5.6/libexec/temp
jvm 1    | 2017.11.05 12:54:24 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/usr/local/Cellar/sonar/5.6/libexec/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /usr/local/Cellar/sonar/5.6/libexec/temp/sq-process4755762987164407465properties
jvm 1    | 2017.11.05 12:54:59 INFO  app[o.s.p.m.Monitor] Process[es] is up
jvm 1    | 2017.11.05 12:54:59 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/usr/local/Cellar/sonar/5.6/libexec/temp -javaagent:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/usr/local/Cellar/sonar/5.6/libexec/lib/jdbc/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /usr/local/Cellar/sonar/5.6/libexec/temp/sq-process6053952846971278151properties

3)
http://localhost:9000/

Then create a project with a key (we can use any name as key).

4)
In Eclipse:

Install Eclipse plugin

Go to "Help" -- "Install New Software" This should display the Install dialog box.

Paste the Update Site URL (http://downloads.sonarsource.com/eclipse/eclipse/) into the field Work with and press Enter. This should display the list of available plugins and components:

5)
In Eclipse:

Configure your local/remote sonar in your Eclipse.

Go to "Window" -- "Preferences" -- "Sonar" -- "Servers".

Sonar Eclipse is pre-configured to access a local Sonar server listening on http://localhost:9000/.

Set username and password (admin and admin)

6)
In Eclipse:

Right click on project and select “Configure” -- “Associate with Sonar”.
In the Sonar project text field, start typing the name of the project which we created in Sonar dashboard and select it in the list box:

7)
In Eclipse:

Run Sonar Analysis in Local:
Right click on project and select “SonarQube” -- “Analyse”.

8)

No comments:

Post a Comment