forked from jenkinsci/warnings-ng-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
86 lines (79 loc) · 3.61 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
84
85
86
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'
recordIssues enabledForFailure: true, tool: mavenConsole()
recordIssues enabledForFailure: true, tools: [java(), javaDoc()], sourceCodeEncoding: 'UTF-8'
recordIssues enabledForFailure: true, tool: checkStyle(pattern: 'target/checkstyle.xml'), sourceCodeEncoding: 'UTF-8'
recordIssues enabledForFailure: true, tool: cpd(pattern: 'target/cpd.xml'), sourceCodeEncoding: 'UTF-8'
recordIssues enabledForFailure: true, tool: pmdParser(pattern: 'target/pmd.xml'), sourceCodeEncoding: 'UTF-8'
recordIssues enabledForFailure: true, tool: spotBugs(pattern: 'target/spotbugsXml.xml'), sourceCodeEncoding: 'UTF-8'
recordIssues enabledForFailure: true, tool: taskScanner(includePattern:'**/*.java', excludePattern:'target/**/*', highTags:'FIXME', normalTags:'TODO'), sourceCodeEncoding: 'UTF-8'
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'
}
}
}