forked from jenkinsci/analysis-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (38 loc) · 1.53 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
node ('linux') {
timeout(60) {
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 install checkstyle:checkstyle findbugs:findbugs"
command = "mvn ${mavenOptions.join(' ')}"
env << "PATH+MAVEN=${tool 'mvn'}/bin"
withEnv(env) {
sh command
}
junit testResults: '**/target/surefire-reports/TEST-*.xml'
warnings consoleParsers: [[parserName: 'Java Compiler (javac)'], [parserName: 'JavaDoc']]
checkstyle pattern: '**/target/checkstyle-result.xml'
findbugs pattern: '**/target/findbugsXml.xml'
}
}
}