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
/
Example.jenkinsfile
42 lines (29 loc) · 1.59 KB
/
Example.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 {
stage ('Checkout') {
git branch:'master', url: '[email protected]:jenkinsci/analysis-model.git'
}
stage ('Build') {
def mvnHome = tool 'mvn-default'
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e clean verify -Dsurefire.useFile=false -Dmaven.test.failure.ignore"
junit testResults: '**/target/surefire-reports/TEST-*.xml'
def java = scanForIssues tool: [$class: 'Java']
def javadoc = scanForIssues tool: [$class: 'JavaDoc']
publishIssues issues:[java,javadoc], unstableTotalAll:1
}
stage ('Analysis') {
def mvnHome = tool 'mvn-default'
sh "${mvnHome}/bin/mvn -batch-mode -V -U -e checkstyle:checkstyle pmd:pmd pmd:cpd findbugs:findbugs spotbugs:spotbugs"
def checkstyle = scanForIssues tool: [$class: 'CheckStyle'], pattern: '**/target/checkstyle-result.xml'
publishIssues issues:[checkstyle], unstableTotalAll:1
def pmd = scanForIssues tool: [$class: 'Pmd'], pattern: '**/target/pmd.xml'
publishIssues issues:[pmd], unstableTotalAll:1
def cpd = scanForIssues tool: [$class: 'Cpd'], pattern: '**/target/cpd.xml'
publishIssues issues:[cpd]
def findbugs = scanForIssues tool: [$class: 'FindBugs'], pattern: '**/target/findbugsXml.xml'
publishIssues issues:[findbugs], unstableTotalAll:1
def spotbugs = scanForIssues tool: [$class: 'SpotBugs'], pattern: '**/target/spotbugsXml.xml'
publishIssues issues:[spotbugs], unstableTotalAll:1
def maven = scanForIssues tool: [$class: 'MavenConsole']
publishIssues issues:[maven]
}
}