Jenkinsfile 1.16 KB
Newer Older
1 2 3
pipeline {

    agent any
4 5 6 7
    tools {
        maven 'mvn-default'
        jdk   'openjdk-8'
    }
8 9

    options {
10
        timeout(time: 60, unit: 'MINUTES')
11 12 13 14 15 16 17 18 19 20 21 22
    }

    stages {

        stage('Cleaning') {
            steps {
                sh 'git clean -fdx'
            }
        }

        stage('Build') {
            steps {
23 24 25 26 27 28
                script {
                    if ( env.BRANCH_NAME ==~ /^release-[.0-9]+$/ ) {
                        sh 'mvn verify assembly:single'
                    }
                    else {
                        sh 'mvn verify site'
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
                    }
                }
            }
        }
    }

    post {
        always {
            archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
            script {
                if ( env.BRANCH_NAME ==~ /^release-[.0-9]+$/ ) {
                    archiveArtifacts artifacts: 'target/*.zip', fingerprint: true
                }
            }
            checkstyle pattern: 'target/checkstyle-result.xml'
            junit 'target/surefire-reports/*.xml'
            jacoco execPattern:'target/**.exec', classPattern: '**/classes', sourcePattern: '**/src/main/java'
        }
    }
}