Thursday, 8 August 2013

Sonar

What is Sonar?
Sonar is a web based code quality analysis tool for Maven/Ant based Java projects. It covers a wide area of code quality check points which include: Architecture & Design, Complexity, Duplications, Coding Rules, Potential Bugs, Unit Test etc. Sonar has a rich set of features like what you would get with different tools such as Covertura, PMD, FindBugs, Check Styles combined.
http://sonar.codehaus.org/
Setting up Sonar
  • Download the latest release of Sonar from http://sonar.codehaus.org/downloads/.
  • Unzip it to a folder, e.g. C:\Sonar

  • Run C:\Sonar\bin\windows-x86-32\StartSonar.bat for Windows. There are several options available for other operationg system such as Linux, Solaris.
  • Browse to http://localhost:9000 . The browser will display a “No projects have been analysed” message. This is a sanity check to see if Sonar is running properly.
  • From within your project, run the following maven command: mvn clean install sonar:sonar
  • Refesh the browser. The code quality related reports such as Complexity, Duplication, Voilation, Rules of Compliance etc will be displayed.
  • To customize the features using the admin console, login/password is admin/admin.

No comments:

Post a Comment