-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (41 loc) · 1.1 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
node('node1') {
def mvnHome
def javaHome
stage('Preparation') { // for display purposes
mvnHome = tool 'm3'
javaHome = tool 'jdk8'
}
stage('Checkout') {
git url:'https://github.com/atinsingh/devopsjava.git', branch:'master'
}
stage('Compile') {
// Run the maven build
withEnv([ "JAVA_HOME=$javaHome", "MVN_HOME=$mvnHome"]) {
sh '"$MVN_HOME/bin/mvn" clean compile'
}
}
stage('Test') {
// Run the maven build
withEnv(["JAVA_HOME=$javaHome", "MVN_HOME=$mvnHome"]) {
sh '"$MVN_HOME/bin/mvn" clean test'
}
}
stage('Publish Test Results') {
junit '**/target/surefire-reports/TEST-*.xml'
}
stage('Package') {
// Run the maven build
withEnv(["JAVA_HOME=$javaHome", "MVN_HOME=$mvnHome"]) {
sh '"$MVN_HOME/bin/mvn" clean package'
}
}
stage('Archive Artifact') {
archiveArtifacts 'target/*.jar'
}
stage('Complete') {
sh 'echo completed'
}
stage('Notify') {
sh 'echo may be sending email'
}
}