You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2021/05/08 18:03:40 UTC

[logging-pipelines] branch master updated: Use withMaven step with jdk8 default

This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-pipelines.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f2b131  Use withMaven step with jdk8 default
0f2b131 is described below

commit 0f2b13181cd1e9eafeed951685b57fb2c22f9806
Author: Matt Sicker <bo...@gmail.com>
AuthorDate: Sat May 8 13:01:16 2021 -0500

    Use withMaven step with jdk8 default
    
    This updates the custom mvn step to use Java 8 by default except for
    log4j on the master branch. This also switches to the withMaven step
    instead of relying on hard-coded paths.
---
 vars/mvn.groovy | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/vars/mvn.groovy b/vars/mvn.groovy
index 647a15f..d3ad1ba 100644
--- a/vars/mvn.groovy
+++ b/vars/mvn.groovy
@@ -16,25 +16,19 @@
  */
 
 def call(String args) {
-    if (isUnix()) {
-        String javaHome = "/home/jenkins/tools/java/latest${BRANCH_NAME == 'master' ? '11' : '1.8'}"
-        configFileProvider([configFile(fileId: 'ubuntu', variable: 'TOOLCHAINS')]) {
-            withEnv([
-                "JAVA_HOME=${javaHome}",
-                "PATH+MAVEN=/home/jenkins/tools/maven/latest3/bin:${javaHome}/bin"
-            ]) {
+    String javaVersion = '1.8'
+    if (env.JOB_NAME == 'log4j' && env.BRANCH_NAME == 'master') {
+        javaVersion = '11'
+    }
+    withMaven(jdk: "jdk_${javaVersion}_latest", maven: 'maven_3_latest') {
+        if (isUnix()) {
+            configFileProvider([configFile(fileId: 'ubuntu', variable: 'TOOLCHAINS')]) {
                 // note that the jenkins system property is set here to activate certain pom properties in
                 // some log4j modules that compile against system jars (e.g., log4j-jmx-gui)
                 sh "mvn --toolchains \"\$TOOLCHAINS\" -Djenkins ${args}"
             }
-        }
-    } else {
-        String javaHome = "f:\\jenkins\\tools\\java\\latest${BRANCH_NAME == 'master' ? '11' : '1.8'}"
-        configFileProvider([configFile(fileId: 'windows', variable: 'TOOLCHAINS')]) {
-            withEnv([
-                "JAVA_HOME=${javaHome}",
-                "PATH+MAVEN=f:\\jenkins\\tools\\maven\\latest3\\bin;${javaHome}\\bin"
-            ]) {
+        } else {
+            configFileProvider([configFile(fileId: 'windows', variable: 'TOOLCHAINS')]) {
                 bat "mvn --toolchains \"%TOOLCHAINS%\" ${args}"
             }
         }