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
34 lines (34 loc) · 819 Bytes
/
Jenkinsfile
File metadata and controls
34 lines (34 loc) · 819 Bytes
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
pipeline {
agent any
tools {
maven 'maven'
}
stages {
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean install'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Run') {
steps {
script {
if (isUnix()) {
sh 'java -jar target/my-app-1.0-SNAPSHOT.jar' // Unix-based command
} else {
bat 'java -jar target/my-app-1.0-SNAPSHOT.jar' // Windows command
}
}
}
}
}
}