From b48c9b9ee99b5941eeee7bd3064823d0179009e9 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 7 Mar 2018 18:22:37 +0000 Subject: [PATCH] jenkins: run static code analysis before compiling --- Jenkinsfile.groovy | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index ef372a4..76a7ac8 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -15,6 +15,14 @@ pipeline { 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') { parallel { stage('Java 8') { @@ -51,15 +59,10 @@ pipeline { archiveArtifacts '**/target/*.jar' } } - stage('Quality') { - steps { - pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: '' - } - } stage('Deploy') { when { expression { (env.GIT_BRANCH == 'master') } } 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" } }