-
Notifications
You must be signed in to change notification settings - Fork 228
/
Jenkinsfile
37 lines (31 loc) · 1.37 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
node {
stage('Checkout') {
checkout scm
}
stage('Build') {
mvn 'clean install -DskipTests'
}
stage('Unit Test') {
mvn 'test'
}
stage('Integration Test') {
mvn 'verify -DskipUnitTests -Parq-wildfly-swarm '
}
}
def mvn(def args) {
def mvnHome = tool 'M3'
def javaHome = tool 'JDK8'
// Apache Maven related side notes:
// --batch-mode : recommended in CI to inform maven to not run in interactive mode (less logs)
// -V : strongly recommended in CI, will display the JDK and Maven versions in use.
// Very useful to be quickly sure the selected versions were the ones you think.
// -U : force maven to update snapshots each time (default : once an hour, makes no sense in CI).
// -Dsurefire.useFile=false : useful in CI. Displays test errors in the logs directly (instead of
// having to crawl the workspace files to see the cause).
// Advice: don't define M2_HOME in general. Maven will autodetect its root fine.
// See also
// https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/maven-and-jdk-specific-version/mavenAndJdkSpecificVersion.groovy
withEnv(["JAVA_HOME=${javaHome}", "PATH+MAVEN=${mvnHome}/bin:${env.JAVA_HOME}/bin"]) {
sh "${mvnHome}/bin/mvn ${args} --batch-mode -V -U -e -Dsurefire.useFile=false"
}
}