This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
/
Jenkinsfile
83 lines (76 loc) · 3.05 KB
/
Jenkinsfile
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
node ('linux') {
timeout(200) {
stage ('Checkout') {
checkout scm
}
stage ('Build') {
String jdk = '8'
String jdkTool = "jdk${jdk}"
List<String> env = [
"JAVA_HOME=${tool jdkTool}",
'PATH+JAVA=${JAVA_HOME}/bin',
]
String command
List<String> mavenOptions = [
'--batch-mode',
'--errors',
'--update-snapshots',
'-Dmaven.test.failure.ignore',
]
if (jdk.toInteger() > 7 && infra.isRunningOnJenkinsInfra()) {
/* Azure mirror only works for sufficiently new versions of the JDK due to Letsencrypt cert */
def settingsXml = "${pwd tmp: true}/settings-azure.xml"
writeFile file: settingsXml, text: libraryResource('settings-azure.xml')
mavenOptions += "-s $settingsXml"
}
mavenOptions += "clean verify checkstyle:checkstyle pmd:pmd findbugs:findbugs jacoco:prepare-agent test jacoco:report -Djenkins.test.timeout=240"
command = "mvn ${mavenOptions.join(' ')}"
env << "PATH+MAVEN=${tool 'mvn'}/bin"
withEnv(env) {
sh command
}
archiveArtifacts artifacts: '**/target/*.hpi', fingerprint: true
junit testResults: '**/target/*-reports/TEST-*.xml'
warnings consoleParsers: [[parserName: 'Java Compiler (javac)'], [parserName: 'JavaDoc'], [parserName: 'Maven']]
checkstyle pattern: '**/target/checkstyle-result.xml'
findbugs pattern: '**/target/*Xml.xml'
pmd pattern: '**/target/pmd.xml'
jacoco()
}
}
}
node ('windows') {
timeout(200) {
stage ('Checkout') {
checkout scm
}
stage ('Build') {
String jdk = '8'
String jdkTool = "jdk${jdk}"
List<String> env = [
"JAVA_HOME=${tool jdkTool}",
'PATH+JAVA=${JAVA_HOME}/bin',
]
String command
List<String> mavenOptions = [
'--batch-mode',
'--errors',
'--update-snapshots',
'-Dmaven.test.failure.ignore',
]
if (jdk.toInteger() > 7 && infra.isRunningOnJenkinsInfra()) {
/* Azure mirror only works for sufficiently new versions of the JDK due to Letsencrypt cert */
def settingsXml = "${pwd tmp: true}/settings-azure.xml"
writeFile file: settingsXml, text: libraryResource('settings-azure.xml')
mavenOptions += "-s $settingsXml"
}
mavenOptions += "clean verify -Djenkins.test.timeout=240"
command = "mvn ${mavenOptions.join(' ')}"
env << "PATH+MAVEN=${tool 'mvn'}/bin"
withEnv(env) {
bat command
}
junit testResults: '**/target/*-reports/TEST-*.xml'
}
}
}