其他分享
首页 > 其他分享> > Jenkins集成Sonar(流水线项目)

Jenkins集成Sonar(流水线项目)

作者:互联网

 

 

 

 

 

 

 

 

 

sonar.projectKey=sp0706_demo01
sonar.projectName=sp0706_demo01
sonar.projectVersion=1.0
sonar.sources=.
sonar.exclusions=**/test/**,**/target/**
sonar.java.source=1.8
sonar.java.target=1.8
sonar.sourceEncoding=UTF-8

  

8.修改Jenkinsfile

pipeline {
    agent any
    stages {
        stage('pull project') {
            steps {
               checkout([$class: 'GitSCM', branches: [[name: '*/${branch}']], extensions: [], userRemoteConfigs: [[credentialsId: 'f193a0fe-6350-48a4-9329-5c02a4012d45', url: 'git@192.168.233.140:kgc_group/web_demo.git']]])
            }
        }
        stage('code checking') {
             steps {
                script {
                    scannerHome = tool 'sonar-scanner'
                }
                withSonarQubeEnv('sonarqube') {
                    sh "${scannerHome}/bin/sonar-scanner"
                }
             }
        }
        stage('build project') {
            steps {
                sh 'mvn clean package'
            }
        }
        stage('publish project') {
            steps {
                deploy adapters: [tomcat8(credentialsId: '07cc8263-ec37-4383-8b0b-1193c8256376', path: '', url: 'http://192.168.233.141:8080')], contextPath: null, war: 'target/*.war'
            }
        }
    }
}

  

 

 

public class Demo01 {
    public static void main(String[] args) {

        int count  = 4/0;
        System.out.println(count);
    }
}

  

标签:target,192.168,project,sonar,steps,流水线,Sonar,Jenkins,stage
来源: https://www.cnblogs.com/lyabbk/p/16163290.html