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:44:54 UTC
(maven-jenkins-lib) 01/01: Give the wrapper a real Maven version, not a pattern
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch wrapper-concrete-version
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git
commit 42e5f141a55689ba1265e2ed28a5d2e27125111e
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Aug 4 13:44:46 2026 +0200
Give the wrapper a real Maven version, not a pattern
The wrapper provisioning added in 53fd00c passes -Dmaven=${maven}, but that
value is the pattern the Jenkinsfiles supply — "4.0.x", "3.9.x" — which
exists to be mapped to a Jenkins tool installation name. The wrapper turns
it into a download URL instead:
mvn ... maven-wrapper-plugin:3.3.4:wrapper -Dmaven=4.0.x
exits 0 and writes
distributionUrl=.../apache-maven/4.0.x/apache-maven-4.0.x-bin.zip
which 404s, so every build using these two entry points fails when ./mvnw
tries to download. Same for 3.9.x.
Resolve the pattern through jenkinsEnv.mvnVersionFromPattern first, and
fail the stage when it cannot, rather than provisioning an URL that will
not resolve.
Requires apache/maven-jenkins-env#8.
Co-Authored-By: Claude Opus 5 (1M context) <no...@anthropic.com>
---
vars/asfMavenTlpPlgnBuild.groovy | 8 +++++++-
vars/asfMavenTlpStdBuild.groovy | 9 ++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index 015cd54..e93d77a 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -188,7 +188,13 @@ def doCreateTask( os, jdk, maven, tasks, first, plan, taskContext )
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
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}"
+ // -Dmaven= becomes a download URL, so it needs a real version:
+ // "4.0.x" would write apache-maven-4.0.x-bin.zip and 404 later.
+ String mvnVersion = jenkinsEnv.mvnVersionFromPattern("${maven}")
+ if (mvnVersion == null) {
+ error "No concrete Maven version for '${maven}'; cannot provision the wrapper"
+ }
+ def wrapperSetup = "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper -Dmaven=${mvnVersion}"
def buildCmd = cmd.clone()
buildCmd[0] = isUnix() ? './mvnw' : 'mvnw.cmd'
if (isUnix()) {
diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy
index 91dfc18..a12acc4 100644
--- a/vars/asfMavenTlpStdBuild.groovy
+++ b/vars/asfMavenTlpStdBuild.groovy
@@ -106,7 +106,14 @@ 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}"
+ // -Dmaven= becomes a download URL, so it needs a real
+ // version: "4.0.x" would write apache-maven-4.0.x-bin.zip
+ // and 404 later.
+ String mvnVersion = jenkinsEnv.mvnVersionFromPattern("${maven}")
+ if (mvnVersion == null) {
+ error "No concrete Maven version for '${maven}'; cannot provision the wrapper"
+ }
+ def wrapperSetup = "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper -Dmaven=${mvnVersion}"
def buildCmd = cmd.clone()
buildCmd[0] = isUnix() ? './mvnw' : 'mvnw.cmd'
if (isUnix()) {