| #!groovy |
| |
| pipeline { |
| agent any |
| options { |
| durabilityHint('PERFORMANCE_OPTIMIZED') |
| buildDiscarder(logRotator(numToKeepStr: '7', artifactNumToKeepStr: '2')) |
| timeout(time: 60, unit: 'MINUTES') |
| } |
| stages { |
| stage( "Parallel Stage" ) { |
| parallel { |
| stage( "Build / Test - JDK8" ) { |
| agent { node { label 'ubuntu' } } |
| options { timeout( time: 120, unit: 'MINUTES' ) } |
| steps { |
| mavenBuild( "JDK 1.8 (latest)", "clean deploy" ) |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| |
| /** |
| * To other developers, if you are using this method above, please use the following syntax. |
| * |
| * mavenBuild("<jdk>", "<profiles> <goals> <plugins> <properties>" |
| * |
| * @param jdk the jdk tool name (in jenkins) to use for this build |
| * @param cmdline the command line in "<profiles> <goals> <properties>"`format. |
| * @return the Jenkinsfile step representing a maven build |
| */ |
| def mavenBuild(jdk, cmdline) { |
| def mvnName = 'Maven 3.6.3' |
| //def localRepo = "${env.JENKINS_HOME}/${env.EXECUTOR_NUMBER}" // ".repository" // |
| //def settingsName = 'oss-settings.xml' |
| def mavenOpts = '-Xms2g -Xmx2g -Djava.awt.headless=true' |
| |
| withMaven( |
| maven: mvnName, |
| jdk: "$jdk", |
| publisherStrategy: 'EXPLICIT', |
| //globalMavenSettingsConfig: settingsName, |
| options: [junitPublisher(disabled: false)], |
| mavenOpts: mavenOpts) { |
| // Some common Maven command line + provided command line |
| sh "mvn -V -B -DfailIfNoTests=false -Dmaven.test.failure.ignore=true $cmdline" |
| } |
| } |