1. Jenkins is a Continuous integration tool developed based on Java for monitoring continuous repetitive work. Its features include: 1. Continuous software release/test project. 2. Monitor the work performed by external calls. Previous [Sonarqube code Quality Management platform set up]- Set up, how do we get Sonarqube to work the way we want? It’s up to Jenkins.
  2. Installing Jenkins is easy. The official website provides the following installation methods

    sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
    sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
    sudo yum installStart/stop/restart command sudo service Jenkinsstart/stopSudo chkconfig JenkinsonCopy the code

    The JAVA environment is required, which is omitted here. Visit: http://ip:8080/ configuration file: / etc/sysconfig/jenkinsJENKINS_HOME = “/ var/lib/Jenkins” JENKINS_PORT = “8080”

    /var/lib/jenkinsJenkins all configuration and all operations stored in the directory Jenkins migration/backup


    jenkins work.jpg

  3. Sonar Plug-in


    Manage plugins. JPG


    Plug-in install.jpg

    Sonar – check – direct setup, setup well as follows


    Installed. JPG

  4. Sonarqube configuration management system – system Settings to add Sonar runner/usr/local/quality/Sonar – runner – 2.4 / such as the need to have directory. / bin/add sonarqube Sonar – runner files


    sonar.jpg


    Sonar configuration success.jpg

  5. Build project New project – part omitted Scheduled task – omitted

    Invoke Standalone SonarQube Analysis.jpg

    Enter check rules in Analysis Properties. Here are rules that apply multiple checks

    #required metadata
    #projectKey The unique identity of the project that cannot be repeated.
    sonar.projectKey=chances_cms
    The #projectName value cannot be in Chinese or the web page part will be garbled
    sonar.projectName=chances_cms
    sonar.projectVersion=4.0
    sonar.sourceEncoding=UTF-8
    sonar.modules=java-module,javascript-module,html-module,CSS-module
    # Java module
    java-module.sonar.projectName=chances_cms_java
    java-module.sonar.language=java
    #. Represents the directory specified by projectBaseDir
    java-module.sonar.sources=src
    java-module.sonar.projectBaseDir=.
    #sonar.binaries=classes
    # JavaScript module
    javascript-module.sonar.projectName=chances_cms_js
    javascript-module.sonar.language=js
    javascript-module.sonar.sources=webapp
    javascript-module.sonar.projectBaseDir=.
    # Html module
    html-module.sonar.projectName=chances_cms_html
    html-module.sonar.language=web
    html-module.sonar.sources=webapp
    html-module.sonar.projectBaseDir=.
    # CSS module
    CSS-module.sonar.projectName=chances_cms_css
    CSS-module.sonar.language=css
    CSS-module.sonar.sources=webapp
    CSS-module.sonar.projectBaseDir=.Copy the code
  6. Execute a build

    Execute build.jpg

    After a successful build, the inspection results are automatically imported into Sonarqube’s database


    The result shows.jpg