forked from lerndevops/samplejavaapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
53 lines (53 loc) · 1.35 KB
/
Copy pathJenkinsfile
File metadata and controls
53 lines (53 loc) · 1.35 KB
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 any
stages {
stage('compile') {
steps {
echo 'compiling..'
git 'https://github.com/rkrCoder/samplejavaapp.git'
sh script: '/opt/maven/bin/mvn compile'
}
}
stage('codereview-pmd') {
steps {
echo 'codereview..'
sh script: '/opt/maven/bin/mvn -P metrics pmd:pmd'
}
post {
success {
recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml')
}
}
}
stage('unit-test') {
steps {
echo 'unittest..'
sh script: '/opt/maven/bin/mvn test'
}
post {
success {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('codecoverage') {
steps {
echo 'Running code coverage..'
script {
def mvnExitCode = sh script: '/opt/maven/bin/mvn verify', returnStatus: true
if (mvnExitCode == 0) {
currentBuild.result = 'SUCCESS'
} else {
currentBuild.result = 'FAILURE'
}
}
}
}
stage('package') {
steps {
echo 'package......'
sh script: '/opt/apache-maven-3.8.4/bin/mvn package'
}
}
}
}