Newer
Older
server / Jenkinsfile
properties([[$class: 'BuildDiscarderProperty', 
                     strategy: [$class: 'LogRotator', numToKeepStr: '5']]])

node {
   def mvnHome
   stage('Preparation') { 
       checkout scm
       mvnHome = tool name: 'MAVEN-3.0', type: 'maven'
       env.JAVA_HOME = tool name: 'JDK8', type: 'jdk'
   }

   stage('Build') {
       if (isUnix()) {
           sh "'${mvnHome}/bin/mvn' -T 2 -Dmaven.test.failure.ignore clean install site:site"
       } else {
           bat(/"${mvnHome}\bin\mvn" -T 2 -Dmaven.test.failure.ignore clean install site:site/)
       }
   }

   stage('Analysis') {
      step([$class: 'JacocoPublisher', execPattern: '**/target/coverage-reports/jacoco-ut.exec', 
                classPattern: '**/target/classes', sourcePattern: '**/src/main/java'])
      step([$class: 'CheckStylePublisher', pattern: '**/target/checkstyle-result.xml'])
      step([$class: 'FindBugsPublisher', pattern: '**/target/findbugsXml.xml'])
      junit '**/target/surefire-reports/TEST-*.xml'
   }
   
   stage('Result') {
      archiveArtifacts artifacts: "**/target/*.zip", fingerprint:true, onlyIfSuccessful:true
   }
}