Skip to content

Pass siteMvn as a String so the site stage runs on Maven 4 - #501

Merged
slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:jenkins-sitemvn-string
Aug 4, 2026
Merged

Pass siteMvn as a String so the site stage runs on Maven 4#501
slachiewicz merged 1 commit into
apache:masterfrom
slachiewicz:jenkins-sitemvn-string

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

siteMvn is passed to doCreateTask whole, while maven is iterated:

for (def mvn in mavens) { ... doCreateTask(os, jdk, mvn, ...) }      // maven: a List is correct
...
doCreateTask( os, jdk, siteMvn, tasks, first, 'site', taskContext )   // siteMvn passed whole

and doCreateTask does jenkinsEnv.mvnFromVersion(os, "${maven}"). A Groovy List stringifies to the literal "[4.0.x]", which matches no case in mvnFromVersion and falls through to default: return 'maven_3_latest'. It is not null either, so the mvnName == null skip never fires — the site stage just quietly runs Maven 3.

maven: [ "4.0.x" ] stays a List; only siteMvn needs to be a String. apache/maven-deploy-plugin already does it this way.

Verified by reading the shared library, not by running a build — the pipeline cannot be executed locally. It also does not make Jenkins green on its own: maven_4_latest still resolves to 4.0.0-rc-5 on the build nodes. This makes the configuration do what it already says.

Same fix as apache/maven-clean-plugin#331.

asfMavenTlpPlgnBuild iterates the `maven` list, so a List is right there,
but `siteMvn` is handed to doCreateTask whole and stringified with
"${maven}". A List becomes the literal "[4.0.x]", which matches no case in
jenkinsEnv.mvnFromVersion and falls through to its default, so the site
stage has been running on maven_3_latest with no error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@slachiewicz

Copy link
Copy Markdown
Member Author

Confirmed in production — this repo's own master build #171:

OS: linux JDK: 17 Maven: 4.0.x   => Label: ubuntu JDK: jdk_17_latest Maven: maven_4_latest
OS: linux JDK: 21 Maven: 4.0.x   => Label: ubuntu JDK: jdk_21_latest Maven: maven_4_latest
OS: linux JDK: 17 Maven: [4.0.x] => Label: ubuntu JDK: jdk_17_latest Maven: maven_3_latest

The first two lines are the maven: list, correctly iterated to a String. The third is siteMvn passed whole, stringified to [4.0.x], resolved to maven_3_latest — the site stage running on Maven 3, exactly as this PR describes. The workspace directory is even named linux-jdk17-m[4.0.x]_site.

Since the shared library started provisioning Maven through the wrapper, the same value now also reaches -Dmaven=, so it fails outright rather than silently downgrading:

+ mvn ... wrapper -Dmaven=[4.0.x]
wget: Failed to fetch .../apache-maven-[4.0.x]-bin.zip
Failed in branch linux-jdk17-m[4.0.x]_site

The library-side fixes are apache/maven-jenkins-env#8 and apache/maven-jenkins-lib#23.

@slachiewicz
slachiewicz merged commit fa2d03d into apache:master Aug 4, 2026
2 checks passed
@slachiewicz
slachiewicz deleted the jenkins-sitemvn-string branch August 4, 2026 13:25
@github-actions github-actions Bot added this to the 4.0.0-beta-2 milestone Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant