-
Notifications
You must be signed in to change notification settings - Fork 1
/
JenkinsfileJdkTests
53 lines (50 loc) · 1.4 KB
/
JenkinsfileJdkTests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pipeline {
agent none
stages {
stage('JDK-14') {
agent {
docker {
image 'maven:3.6-jdk-14'
args '-v /home/jenkins/.m2:/var/maven/.m2 -v /home/jenkins/.gnupg:/.gnupg -e MAVEN_CONFIG=/var/maven/.m2 -e MAVEN_OPTS=-Duser.home=/var/maven'
}
}
steps {
testAgainstJdk("14")
}
}
stage('JDK-17') {
agent {
docker {
image 'maven:3.6-jdk-17'
args '-v /home/jenkins/.m2:/var/maven/.m2 -v /home/jenkins/.gnupg:/.gnupg -e MAVEN_CONFIG=/var/maven/.m2 -e MAVEN_OPTS=-Duser.home=/var/maven'
}
}
steps {
testAgainstJdk("17")
}
}
}
}
void testAgainstJdk(version) {
stage("Show Versions") {
script {
sh 'mvn -version'
sh 'java -version'
sh 'javac -version'
}
}
stage("Clean Maven Project") {
script {
sh 'mvn clean -Dmaven.clean.failOnError=false -Dmaven.clean.retryOnError=true'
}
}
stage("Test against JDK $version") {
script {
try {
sh "mvn verify -Dmaven.compiler.release=$version"
} catch (err) {
currentBuild.result = 'FAILURE'
}
}
}
}