pipeline { agent { label 'maven' } stages { stage('Build') { steps { sh 'mvn -e -B -Pjenkins -DskipTests clean install jacoco:prepare-agent spotbugs:spotbugs' } } stage('Test') { steps { sh 'mvn -B -Pjenkins test' } } stage ('Analysis') { steps { sh 'mvn --batch-mode -V -U -e checkstyle:checkstyle pmd:pmd pmd:cpd spotbugs:spotbugs site' } } stage ('Push artefactss to artrepo') { steps { sh 'mvn -Pjenkins deploy' } } } post { always { junit testResults: '**/target/surefire-reports/TEST-*.xml' recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()] recordIssues enabledForFailure: true, tool: spotBugs() recordIssues enabledForFailure: true, tool: checkStyle() recordIssues enabledForFailure: true, tool: cpd(pattern: '**/target/cpd.xml') recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml') } success { slackSend color: 'good', channel: '#bolc-ci-cd', message: "Build ${JOB_NAME}#${BUILD_NUMBER} success.\nDetails: ${JOB_URL}" } failure { slackSend color: 'bad', channel: '#bolc-ci-cd', message: "Build ${JOB_NAME}#${BUILD_NUMBER} failure.\nDetails: ${JOB_URL}" } } }