Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 11 additions & 140 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,140 +1,11 @@
pipeline {
agent any

environment {
JDK_TOOL_NAME = 'JDK 21'
MAVEN_TOOL_NAME = 'Maven 3.9.9'
}

options {
skipStagesAfterUnstable()
disableConcurrentBuilds abortPrevious: true
}

stages {
stage('Clean') {
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn clean'
}
}
}
stage('Format Check') {
options {
timeout(activity: true, time: 60, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn spotless:check'
}
}
}
stage('Build') {
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -DskipTests=true package'
}
}

post {
success {
archiveArtifacts artifacts: '**/target/*.jar'
}
}
}
stage('Code Analysis') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn pmd:pmd pmd:cpd spotbugs:spotbugs'
}
}
post {
always {
recordIssues enabledForFailure: true, tools: [spotBugs(), cpd(pattern: '**/target/cpd.xml'), pmdParser(pattern: '**/target/pmd.xml')]
}
}
}
stage('Unit Tests') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -P coverage -Dskip.failsafe.tests=true test'
}
}
post {
always {
junit testResults: '**/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Integration Tests') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -P coverage -Dskip.surefire.tests=true verify'
}
}
post {
always {
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
}
success {
discoverReferenceBuild()
recordCoverage(tools: [[ parser: 'JACOCO' ]],
id: 'jacoco', name: 'JaCoCo Coverage',
sourceCodeRetention: 'LAST_BUILD')
}
}
}
stage('Deploy to Internal Nexus Repository') {
when {
anyOf {
branch 'main'
tag 'v*'
}
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
// Tests were already executed separately, so disable tests within this step
sh 'mvn -DskipTests=true deploy'
}
}
}
}
post {
always {
recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()]
}
}
}
@Library('jenkins-ci-library') _

standardPipeline(
jdkTool: 'JDK 21',
mavenTool: 'Maven 3.9.9',
spotlessTimeout: 60,
buildTimeout: 120,
intTestTimeout: 120,
codeAnalyseTimeout: 120,
uniTestTimeout: 120
)