After installing the sonar, you need to integrate with the Jenkins that the project is in, and the principle of Jenkins and sonar integration is probably this, Jenkins in its plug-in Management center, download the sonar plug-in and configure it with the sonar connection. Jenkins then notifies sonar of the operation of the source code analysis once the integrated build is completed. We all know Jenkins in the process of construction is to download from the SVN source this step of the operation, and Sonar is the Jenkins download good source code for the interpretation of the quality of the codes and other parameters to the graphical display of the page to the user.
Here's how Jenkins and sonar integrate and coordinate their work.
Plug-in installation
1. Online Installation:
Select Jenkins System Management-> Management plug-in-> optional plug-in bar, search Sonarqube Plugin, click to install directly.
However, this online installation generally does not work, because to access Google for downloading.
So we use the off-line installation method.
2. Offline Installation:
①. First download Sonarqube plugin plugin: https://wiki.jenkins-ci.org/display/JENKINS/SonarQube+plugin, download is Sonar.hpi file.
②. Select Jenkins System Management-> Admin Plug-in-> advanced-> upload Plugin
Just download the plugin sonar.hpi, upload to Jenkins, and according to the prompts to restart Jenkins can be.
After rebooting to the plugin management-> installed-> to see if Sonarqube plugin exists
The previous diagram plug-in appears, indicating that the installation was successful.
Sonarqube plugin Configuration
Locate the System Management-> system settings->sonarqube Bar, and make the following settings.
Conduct a project analysis
Select a project that can be successfully built and modify its configuration.
Increase the build after the operation step->sonarqube can.
When you add a configuration, the item's page appears with a Sonarqube flag
Then click Build immediately, after the build is complete, Jenkins will notify sonar to conduct code quality analysis, login sonar view
has been more than the configuration of the project, so we can easily go to the code to check, analyze the quality of the code. We have come a step further from the automation environment.