Step by step setup of Sonar Qube :
- Download Sonar Qube (ex:
sonarqube-6.7)
- Download Sonar Scanner
(ex: sonar-scanner-cli-3.0.3.778-windows)
- Set Java path for sonar
qube by setting Java path in wrapper.java.command property in the
<SonarQube_Path>\config\wrapper.conf file
- Add project details in
to <Sonar_Scanner_Path>/conf/sonar-scanner.properties
- sonar.host.url=http://localhost:9000
- sonar.sourceEncoding=UTF-8
- sonar.projectKey=project_name:app_name
- sonar.projectName=PROJECT_NAME
- sonar.projectVersion=1.0
- sonar.sourceEncoding=UTF-8
- sonar.modules=module1
- sonar.sources=src
- module1.sonar.projectName=module1
- Extract the custom jar to convert the metadata into JS in any path (say: to <Sonar_Scanner_Path>\jar\SourceCode_Extract_V3)
- To get above custom jar , mail me at manikandaan.k@gmail.com
- Say the source code to
be covered by sonar is at the path :
C:/mani/dev/amx-peru/om/drop2/sprint_3/07-JAVA/core/metadata/
- Create empty folder
structure at tha path <Sonar_Scanner_Path>\bin\module1\src
- To convert then XML
metadata into scan able JavaScript, execute below command.
- java -jar
SourceCode_Extract_V3.jar
C:/mani/dev/amx-peru/om/drop2/sprint_3/07-JAVA/core/metadata/
C:/mani/tools/java/sonar-scanner-cli-3.0.3.778-windows/sonar-scanner-3.0.3.778-windows/bin/module1/src
- Above command will
create the JavaScript metadata corresponding to the given source code in
the path <Sonar_Scanner_Path>\bin\module1\src
- Start Sonar Qube by
executing StartSonar.bat file from the
path:<SonarQube_Path>\bin\windows-x86-32
- Above command will run
the sonar qube engine in 9000 port. We can access it by http://localhost:9000/projects
- Start Sonar Scanner by
executing sonar-scanner.bat file from the path :
<Sonar_Scanner_Path>\bin
- On Start, sonar scanner will scan the project based on the inputs details given in sonar-scanner.properties
- On Completion of scan, below message is displayed,
- Scanned result can be accessed through http://localhost:9000/dashboard/index/project_name:app_name
0 comments :
Post a Comment