Verifying Java code using SonarQube
Now let's a new Quality Profile
and assign the project so every time static code analysis is performed, the default profile is not but a custom profile is utilized.
Getting ready
Go to
Quality Profiles
and in the Java section, copy the default profile:

- Give a specific name to it and click on
Copy
:

- We can specify projects for a specific
Quality Profile
by clicking onChange Projects
as well:

- Assign a Quality Profile to your project so that the same profile is used every time a static code analysis is performed. Hence, we can use different profiles for different projects based on our requirements.
How to do it...
- Go to the Jenkins dashboard and click on
New Item
. - Give the
Name
and selectFreestyle project
. - Provide the
Repository URL
in theSource Code Management
section. - Go to the
Build
section and selectExecute SonarQube Scanner
. - You can provide the location of
sonar-project.properties
or provide details directly for static code analysis:
# Required metadata sonar...