forked from jenkins-docs/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathJenkinsfile
More file actions
59 lines (55 loc) · 1.18 KB
/
Jenkinsfile
File metadata and controls
59 lines (55 loc) · 1.18 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
54
55
56
57
58
59
pipeline{
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2'
}
}
stages {
stage('Maven-Clean'){
steps{
sh 'mvn clean'
}
}
stage('Maven-Compile'){
steps{
sh 'mvn compile'
}
}
stage('Maven_Test'){
steps{
sh 'mvn test'
}
}
stage("build & SonarQube analysis") {
agent any
steps{
script{
withSonarQubeEnv('sonarserver') {
sh "mvn sonar:sonar"
}
timeout(time: 1, unit: 'MINUTES') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
sh "mvn clean install"
}
}
}
}
stage('Maven-Package'){
steps{
// retry(3){
sh 'mvn package'
// }
}
// post{
// failure{
// sh 'mvn package'
// }
// }
}
}
}