Saturday, April 4, 2015

SONAR setup

Please follow below given steps for setting up SONAR in local dev environment:

1. Download Sonar from following link: http://dist.sonar.codehaus.org/sonar-3.5.1.zip
2. Unzip and save the downloaded sonar zip in localfile system.
3. Navigate to sonar bin path for example C:\Softwares\sonar-3.5.1\bin\windows-x86-64
4. Execute StartSonar.bat. In this step sonar is started. leave the comand prompt as it is.
5. Go to  Browser and access  sonar by http://localhost:9000
6. We can login to sonar using the login and password admin:admin
7. Go to Settings->Quality Profiles. Click on "Restore Profile" on the top right and select the            Sonar_Rules.xml which is attached below. Now you should see new Quality Profile "Sonar_Rules".    Set it as default.
8. Go to Settings->Configuration->Exclusions. Add following exclusions to Source File Exclusions section. This is to exclude unnecessary source files in metric calculations.
com/compname/project/**/model/**/*.java
com/compname/project/**/*Constant*.java
com/compname/project/**/*Exception.java
9. Navigate to root of your project path using windows command prompt and run: mvn sonar:sonar - In this step, our project build will be deployed in sonar
10. We can see our project listed on the Home screen. we can see the sonar report generated during ST build 

No comments:

Post a Comment