You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/08/04 11:30:10 UTC

(maven-jenkins-lib) branch master updated: Run Maven wrapper with specific Maven version

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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new 53fd00c  Run Maven wrapper with specific Maven version
53fd00c is described below

commit 53fd00c747f05f1a89ef46854a00ada92c669614
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Aug 4 12:48:14 2026 +0200

    Run Maven wrapper with specific Maven version
---
 vars/asfMavenTlpPlgnBuild.groovy | 23 ++++++++++++++---------
 vars/asfMavenTlpStdBuild.groovy  |  9 +++++++--
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index 909979a..015cd54 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -186,15 +186,20 @@ def doCreateTask( os, jdk, maven, tasks, first, plan, taskContext )
             withEnv(["JAVA_HOME=${ tool "$jdkName" }",
                "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
                "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
-             dir (stageDir) {
-               GitCheckoutHelper.checkoutScm(this, scm, taskContext.fetchDepth)
-               if (isUnix()) {
-                 sh 'df -hT'
-                 sh cmd.join(' ')
-               } else {
-                 bat 'wmic logicaldisk get size,freespace,caption'
-                 bat cmd.join(' ')
-                }
+              dir (stageDir) {
+                GitCheckoutHelper.checkoutScm(this, scm, taskContext.fetchDepth)
+                def wrapperSetup = "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper -Dmaven=${maven}"
+                def buildCmd = cmd.clone()
+                buildCmd[0] = isUnix() ? './mvnw' : 'mvnw.cmd'
+                if (isUnix()) {
+                  sh 'df -hT'
+                  sh wrapperSetup
+                  sh buildCmd.join(' ')
+                } else {
+                  bat 'wmic logicaldisk get size,freespace,caption'
+                  bat wrapperSetup
+                  bat buildCmd.join(' ')
+                 }
               }
             }
           } catch (Throwable e) {
diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy
index aae2e00..91dfc18 100644
--- a/vars/asfMavenTlpStdBuild.groovy
+++ b/vars/asfMavenTlpStdBuild.groovy
@@ -106,10 +106,15 @@ def call(Map params = [:]) {
                               ], publisherStrategy: 'EXPLICIT') {
                       dir ('m') {
                         GitCheckoutHelper.checkoutScm(this, scm, fetchDepth)
+                        def wrapperSetup = "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper -Dmaven=${maven}"
+                        def buildCmd = cmd.clone()
+                        buildCmd[0] = isUnix() ? './mvnw' : 'mvnw.cmd'
                         if (isUnix()) {
-                          sh cmd.join(' ')
+                          sh wrapperSetup
+                          sh buildCmd.join(' ')
                         } else {
-                          bat cmd.join(' ')
+                          bat wrapperSetup
+                          bat buildCmd.join(' ')
                         }
                       }
                     }