Sonarqube4.4 + Jenkins: code check instance 2

Source: Internet
Author: User

In sonarqube4.4 + Jenkins, one of the code check instances, this article describes how to check without compiling.

However, some code checks require bytecode. For example, if the findbugs check depends on bytecode, The findbugs check cannot be performed only when the source code is extracted in instance 1.

Compile the findbugs check. The following instance operations demonstrate how to set up


First of all, of course, is to download the latest findbugs http://docs.codehaus.org/display/SONAR/FindBugs+Plugin, the current latest version is V3.0, supports analysis of Java 8 bytecode but requires Java 1.7 to run (see compatibility section ). Download the corresponding jar package to \ sonarqube-4.4 \ extensions \ plugins, where \ sonarqube-4.4 is the installation directory of sonarqube, and then restart sonarqube

1B, which can also be downloaded from the update center of sonarqube. After downloading, follow the prompts to restart sonarqube.

2. log on to sonar as admin and change the default quality profiles to sonar way with findbugs.

3. Configure the project in Jenkins. Take maven3 as an example and select maven2/3.

4. Follow the normal configuration of Maven project and leave it blank in goals and options. Use the default

5, add windows batch command in post steps, command: sonarqube runner v2.4 installation location \ bin \ sonar-runner.bat

6. to configure the project, inform the sonarqube of the compilation result and add the update to SVN, as shown below:

# required metadata sonar.projectKey=Keqiang:CodeKatabySonarRunnersonar.projectName=CodeKatabySonarRunnersonar.projectVersion=2.0.0  # path to source directories (required) sonar.sources=src/main/java# path to project binaries (optional), for example directory of Java bytecode sonar.binaries=target/classes

7. Build this job in Jenkins now

8. visit http: // localhost: 9000 to see the sonarqube results. We can see the newly discovered issue according to the findbugs rules.

Note 1: sonar way with findbugs is the default choice for sonarqube. There are 497 rules in total. Sonarqube provides a convenient interface for modification.

NOTE 2: sonarqube sets up the overall indicator technical debt for the issue, which expresses the amount of time required to fix the issue based on the workload.


Summary: The above configuration is simple. To put it bluntly, you only need to explain where the compilation result is.

The above two instances hope readers can understand how easy it is to build sonarqube.

Jenkins is not required. using sonar-runner can achieve the same correlation. After Jenkins support is added, it can be automatically started according to SVN operations.




Sonarqube4.4 + Jenkins: code check instance 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.