Monday, April 30, 2012

How to run sonar for Maven based java project


To run sonar, either we can directly run using maven script or we can run sonar from eclipse plugins.
To run sonar report, first we have to install maven & sonar in our local machine.


  1. Download and extract Maven in your C drive from http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.zip
  2. Install Jdk 
  3. Download and extract Sonar in your D drive from http://dist.sonar.codehaus.org/sonar-3.0.zip
  4. Now go to D:\sonar-3.0\bin\windows-x86-32 and double click on StartSonar.batNow sonar server will start locally on http://localhost:9000
  5.  Go to parent folder of your project, and run following command
    mvn clean compile install sonar:sonar as below
  6. After its completion, browse http://localhost:9000/ where you will see the project list with code quality report as below

No comments:

Post a Comment