Skip to content

Commit 688aeca

Browse files
committed
ci: Add Jenkinsfile
1 parent c0c3406 commit 688aeca

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

Jenkinsfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
pipeline {
2+
agent any
3+
4+
environment {
5+
JDK_TOOL_NAME = 'JDK 21'
6+
MAVEN_TOOL_NAME = 'Maven 3.9.9'
7+
}
8+
9+
options {
10+
skipStagesAfterUnstable()
11+
disableConcurrentBuilds abortPrevious: true
12+
}
13+
14+
stages {
15+
stage('Clean') {
16+
steps {
17+
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
18+
sh 'mvn clean'
19+
}
20+
}
21+
}
22+
stage('Format Check') {
23+
options {
24+
timeout(activity: true, time: 60, unit: 'SECONDS')
25+
}
26+
steps {
27+
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
28+
sh 'mvn spotless:check'
29+
}
30+
}
31+
}
32+
stage('Build') {
33+
options {
34+
timeout(activity: true, time: 120, unit: 'SECONDS')
35+
}
36+
steps {
37+
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
38+
sh 'mvn -DskipTests=true package'
39+
}
40+
}
41+
42+
post {
43+
success {
44+
archiveArtifacts artifacts: '**/target/*.jar'
45+
}
46+
}
47+
}
48+
stage('Deploy to Internal Nexus Repository') {
49+
when {
50+
anyOf {
51+
branch 'main'
52+
tag 'v*'
53+
}
54+
}
55+
steps {
56+
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
57+
// Tests were already executed separately, so disable tests within this step
58+
sh 'mvn -DskipTests=true deploy'
59+
}
60+
}
61+
}
62+
}
63+
post {
64+
always {
65+
recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()]
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)