Wednesday 10 December 2014

SonarQube Tool set up manually

you can use sonar in manual process way..

Eclipse plugin approach is available her

http://javadeveloperchoiceno1.blogspot.in/p/sonar.html

Installation Steps:


·         Go to http://www.sonarqube.org/downloads/ link and download latest version of SonarQube and SonarQube Runner. Extract the zip to local directory.
·         Set SONAR_RUNNER_HOME environment variable to SonarQube directory.
Ex: SONAR_RUNNER_HOME =D:\sonar-runner-2.3
·         Set JAVA_HOME Path

·         Set Path=% JAVA_HOME %;% SONAR_RUNNER_HOME %;

Starting SonarQube Server & Running Project Analyzer the project:


·         Open command prompt & go to SonarQube/bin/ directory. In bin directory there are many directories. Go to suitable directory depending on your OS. For example for Windows with 32 bit directory would be SonarQube/bin/ windows-x86-32.
·         Run StartSonar.bat command & wait for few seconds to start the server.
         
       open browser & go to http://localhost:9000/ URL to confirm the SoanarQube server is up & running. 
        
       then
       ·         Click on Login link to login with default user name “admin” & password “admin”.
·         In order to analyze the project, we have to create “sonar-project.properties” file in our java project root directory. Sample “sonar-project.properties” file:

fi     fill these detail inside property file
        # Required metadata
sonar.projectKey=java-sonar-runner-simple
sonar.projectName=ETailWebApp
sonar.projectVersion=1.0

# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8


·       Open command prompt & go to Java project root directory which we want to analyze (Make sure SonarQube server is started & “sonar-project.properties” file is in project root directory).
Run sonar-runner batch file which is in sonar-runner/bin directory (We have downloaded sonar-runner.zip & sonarqube.zip file & extracted it in local file

open cmd use follwing kind of command
 cd D:\GE GDC Working Folder\ashish.negi\EtailProject\ETailWebApp_4
go up to your project..which has sonnar properties file
 then

use this command
D:\Sonar\sonar-runner-2.3\bin\sonar-runner.bat

now you can see porject been interarated with report
Now go to http://localhost:9000/ to open the Dashboard. Now in project section there will be a project.

after this

Ø  After getting Project into Sonar… Use following URL…
Ø  Save xml file into local… Ex: D:\violations.xml
Ø  Open that xml file from     Excel. ( We will get Excel Report here..)




while doing all this set up you can get some issue please follow following url


 



t







No comments:

Post a Comment