jenkins: only enter some stages when suitable files exist
This commit is contained in:
parent
a377a3b508
commit
1cc7246d85
1 changed files with 3 additions and 0 deletions
|
@ -20,6 +20,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Static Code Analysis') {
|
stage('Static Code Analysis') {
|
||||||
|
when { expression { findFiles(glob: '**/src/main/java/*.java').length > 0 } }
|
||||||
steps {
|
steps {
|
||||||
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
|
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
|
||||||
sh "${mvn} compile checkstyle:checkstyle pmd:pmd"
|
sh "${mvn} compile checkstyle:checkstyle pmd:pmd"
|
||||||
|
@ -46,6 +47,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test Results') {
|
stage('Test Results') {
|
||||||
|
when { expression { findFiles(glob: '**/target/surefire-reports/*.xml').length > 0 } }
|
||||||
steps {
|
steps {
|
||||||
junit '**/target/surefire-reports/*.xml'
|
junit '**/target/surefire-reports/*.xml'
|
||||||
jacoco exclusionPattern: '**/*{Test|IT|Main|Application|Immutable}.class'
|
jacoco exclusionPattern: '**/*{Test|IT|Main|Application|Immutable}.class'
|
||||||
|
@ -59,6 +61,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Archiving') {
|
stage('Archiving') {
|
||||||
|
when { expression { findFiles(glob: '**/target/*.jar').length > 0 } }
|
||||||
steps {
|
steps {
|
||||||
archiveArtifacts '**/target/*.jar'
|
archiveArtifacts '**/target/*.jar'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue