jenkins: run static code analysis before compiling

This commit is contained in:
Paul Campbell 2018-03-07 18:22:37 +00:00
parent b5a225af69
commit b48c9b9ee9

View file

@ -15,6 +15,14 @@ pipeline {
error("Build failed because SNAPSHOT version") error("Build failed because SNAPSHOT version")
} }
} }
stage('Static Code Analysis') {
steps {
withMaven(maven: 'maven-3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} checkstyle:checkstyle pmd:pmd"
}
pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
}
}
stage('Build') { stage('Build') {
parallel { parallel {
stage('Java 8') { stage('Java 8') {
@ -51,15 +59,10 @@ pipeline {
archiveArtifacts '**/target/*.jar' archiveArtifacts '**/target/*.jar'
} }
} }
stage('Quality') {
steps {
pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
}
}
stage('Deploy') { stage('Deploy') {
when { expression { (env.GIT_BRANCH == 'master') } } when { expression { (env.GIT_BRANCH == 'master') } }
steps { steps {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') { withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "${mvn} deploy --activate-profiles release -DskipTests=true" sh "${mvn} deploy --activate-profiles release -DskipTests=true"
} }
} }