forked from jenkins-docs/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
63 lines (55 loc) · 1.76 KB
/
Jenkinsfile
File metadata and controls
63 lines (55 loc) · 1.76 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
60
61
62
63
pipeline {
agent any
tools {
maven 'maven3.1'
}
stages {
stage('Checkout') {
steps {
checkout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/gargmukku07/simple-java-maven-app.git']])
}
}
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Sonar') {
steps {
withSonarQubeEnv(installationName: 'SonarQube', credentialsId: 'sonarQube') {
sh 'mvn sonar:sonar'
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
// stage('Sonar') {
// steps {
// script {
// def scannerHome = tool 'sonarscanner';
// withSonarQubeEnv(credentialsId: 'sonarQube') {
// sh "${scannerHome}/bin/sonar-scanner \
// -Dsonar.projectKey=myprjdemo \
// -Dsonar.projectName=DEMO-Project \
// -Dsonar.projectVersion=1.5 \
// -Dsonar.sources=src \
// -Dsonar.java.binaries=."
// }
// }
// }
// post {
// always {
// junit 'target/surefire-reports/*.xml'
// }
// }
// }
}
}