KEMBAR78
DevOPS Lab11 | PDF | Databases | Java (Programming Language)
0% found this document useful (0 votes)
14 views5 pages

DevOPS Lab11

Uploaded by

bslsdevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

DevOPS Lab11

Uploaded by

bslsdevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Lab – 11

Sonar Cube
Aim: To implement Sonar Cube server on windows platform
Procedure:
Description: Sonar-Qube is a Code Quality Assurance tool that collects and analyzes source code, and
provides reports for the code quality of your project.
Sonar-Qube Architecture can be classified in four components
1. Sonar Scanner - Previously known as sonar runner. Ideally you need to use any of
the built-in tools such as ant, Maven or Gradle that invokes the Sonar Scanner to
fetch the source code. Sonar Qube cube supports plug-ins like SVN and some of
the other version control system
2. Source Code - The source code is the code written by developer or manager. The
code is then pushed to repository.
3. Sonar Analyzer - Sonar analyzer takes the source code you would like to analyze
and go through all the code and gives you technical problems
4. Sonar Qube Database - The reports generated by Sonar Cube will be sent to the
database. There is a caching server which is used to hold the temporary reports in
the cache, Sonar Qube will have a default database You can integrate your own
database our to your Sonar Qube Sonar Qube supports various databases like a ms
SQL Server, Oracle etc.

Requirements: Require Java 17 Version minimum, 1GB of free RAM in system


Installation: 1. Go to C:\sonarqube-9.9.0.65466\bin\windows-x86-64 path, there is Start Sonar
window batch file right click on run as administrator.

2. Set the java path environmental variable


setx SONAR_JAVA_PATH "C:\Program Files\java_home\bin\java.exe"
3. Open command prompt Navigate to below path and run StartSonar.bat file
cd C:\sonarqube-9.9.0.65466\bin\windows-x86-64
<SONARQUBE_HOME>/bin/windows-x86-64/StartSonar. Bat
4. Now Access Sonar Qube from Windows using localhost:9000
5. Sonar Qube default username and password, login: admin and password: admin
and click on login button. Now you can update password/username

6. Once set navigate to Sonar Qube Dashboard

7.

Managing: Login to Jenkins configuration domain with https://jenkins.domain.com


Choose specific profile
Configure Sonar job
Click the pipeline option from items panel then select 'Maven'

Configure 'Changes' option to Enable


For Build option choose 'Jenkins'
Configure source code read from 'GitHub' or 'Git/SVN'

Now tune up Sonar Qube integrations as


Select the pipeline

Finally add plugin code and prepare Jenkin file code


[java]try {
stage(“Building SONAR …”) {
sh ‘./Mavenw clean sonarqube’
}
} catch (e) {emailext attachLog: true, body: ‘See attached log’, subject: ‘BUSINESS
Build Failure’, to: ‘abc@gmail.com’
step([$class: ‘WsCleanup’])
return
}
[/java]
Now run the pipeline results the code execution from Sonar Qube as

You might also like