Skip to content

Commit c63b169

Browse files
authored
Update Jenkinsfile rkr
1 parent 9bd29b4 commit c63b169

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Jenkinsfile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ pipeline {
44
stage('compile') {
55
steps {
66
echo 'compiling..'
7-
git 'https://github.com/shubhsharm/samplejavaapp'
8-
sh script: '/opt/apache-maven-3.8.4/bin/mvn compile'
7+
git 'https://github.com/rkrCoder/samplejavaapp.git'
8+
sh script: '/opt/maven/bin/mvn compile'
99
}
1010
}
1111
stage('codereview-pmd') {
1212
steps {
1313
echo 'codereview..'
14-
sh script: '/opt/apache-maven-3.8.4/bin/mvn -P metrics pmd:pmd'
14+
sh script: '/opt/maven/bin/mvn -P metrics pmd:pmd'
1515
}
1616
post {
1717
success {
@@ -22,7 +22,7 @@ pipeline {
2222
stage('unit-test') {
2323
steps {
2424
echo 'unittest..'
25-
sh script: '/opt/apache-maven-3.8.4/bin/mvn test'
25+
sh script: '/opt/maven/bin/mvn test'
2626
}
2727
post {
2828
success {
@@ -32,13 +32,15 @@ pipeline {
3232
}
3333
stage('codecoverage') {
3434
steps {
35-
echo 'codecoverage..'
36-
sh script: '/opt/apache-maven-3.8.4/bin/mvn cobertura:cobertura -Dcobertura.report.format=xml'
37-
}
38-
post {
39-
success {
40-
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
41-
}
35+
echo 'Running code coverage..'
36+
script {
37+
def mvnExitCode = sh script: '/opt/maven/bin/mvn verify', returnStatus: true
38+
if (mvnExitCode == 0) {
39+
currentBuild.result = 'SUCCESS'
40+
} else {
41+
currentBuild.result = 'FAILURE'
42+
}
43+
}
4244
}
4345
}
4446
stage('package') {

0 commit comments

Comments
 (0)