pipeline

pipeline {
    agent any
    stages {
         stage('echo') {
            steps {
             echo "${env.WORKSPACE}\\sss.xml"
            }
        }
        
        stage('pull code') {
            steps {
                checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'ssh', url: '[email protected]']]])
            }
        }
    stage('build project') {
            steps {
                bat '''D:/apache-maven-3.5.3/bin/mvn -Dskip.Test=false clean package -s settings.xml'''
                echo 'Hello World --build'
            }
        }
    stage('deploy item') {
            steps {
                echo 'Hello World-----deploy'
            }
        }
    }
    
      post {
                // 总数发布测试情况
                always {
                echo "post always"
                }
                
                // success, record the test results and archive the jar file.
                   success {
                    junit '**/target/surefire-reports/TEST-*.xml'
                 
                   }
                // failed, record the test results and archive the jar file.
                   failure {
                        junit '**/target/surefire-reports/TEST-*.xml'
                   }
            }
}

sonar.language=java
sonar.projectKey=com.example.jenkinstest
sonar.projectName=jenkinstest
sonar.sources=src/main/java
sonar.java.binaries=./target/classes
sonar.sourceEncoding=UTF-8
sonar.core.codeCoveragePlugin=jacoco

你可能感兴趣的:(pipeline)