-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
44 lines (35 loc) · 1.12 KB
/
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
43
44
node {
stage 'checkout'
// Get some code from a GitHub repository
git url: 'https://github.com/gajapathi28/Hackathon.git'
sh 'git clean -fdx; sleep 4;'
// Get the maven tool.
// ** NOTE: This 'mvn' maven tool must be configured
// ** in the global configuration.
def mvnHome = tool 'MAVEN_HOME'
stage('SonarQube analysis') {
withSonarQubeEnv('sonar') {
requires SonarQube Scanner for Maven 3.2+
sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar'
}
}
stage 'clean'
sh "${mvnHome}/bin/mvn clean"
stage 'compile'
sh "${mvnHome}/bin/mvn compile"
stage 'sonar'
sh "${mvnHome}/bin/mvn sonar:sonar"
stage 'build'
// set the version of the build artifact to the Jenkins BUILD_NUMBER so you can
// map artifacts to Jenkins builds
sh "${mvnHome}/bin/mvn versions:set -DnewVersion=${env.BUILD_NUMBER}"
sh "${mvnHome}/bin/mvn package"
stage 'test'
parallel 'test': {
sh "${mvnHome}/bin/mvn test; sleep 2;"
}, 'verify': {
sh "${mvnHome}/bin/mvn verify; sleep 3"
}
stage 'deploy'
sh "${mvnHome}/bin/mvn deploy"
}