github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/samples/Jenkinsfile (about) 1 node { 2 stage('Checkout') { 3 checkout scm 4 } 5 6 stage('Build') { 7 mvn 'clean install -DskipTests' 8 } 9 10 stage('Unit Test') { 11 mvn 'test' 12 } 13 14 stage('Integration Test') { 15 mvn 'verify -DskipUnitTests -Parq-wildfly-swarm ' 16 } 17 } 18 19 def mvn(def args) { 20 def mvnHome = tool 'M3' 21 def javaHome = tool 'JDK8' 22 23 // Apache Maven related side notes: 24 // --batch-mode : recommended in CI to inform maven to not run in interactive mode (less logs) 25 // -V : strongly recommended in CI, will display the JDK and Maven versions in use. 26 // Very useful to be quickly sure the selected versions were the ones you think. 27 // -U : force maven to update snapshots each time (default : once an hour, makes no sense in CI). 28 // -Dsurefire.useFile=false : useful in CI. Displays test errors in the logs directly (instead of 29 // having to crawl the workspace files to see the cause). 30 31 // Advice: don't define M2_HOME in general. Maven will autodetect its root fine. 32 // See also 33 // https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/maven-and-jdk-specific-version/mavenAndJdkSpecificVersion.groovy 34 withEnv(["JAVA_HOME=${javaHome}", "PATH+MAVEN=${mvnHome}/bin:${env.JAVA_HOME}/bin"]) { 35 sh "${mvnHome}/bin/mvn ${args} --batch-mode -V -U -e -Dsurefire.useFile=false" 36 } 37 }