slachiewicz opened a new pull request, #8:
URL: https://github.com/apache/maven-jenkins-env/pull/8

   Companion to a fix in `maven-jenkins-lib` — see below for why it is needed 
now.
   
   `mvnFromVersion` maps a version *pattern* (`4.0.x`, `3.x.x`) to a Jenkins 
**tool installation name** (`maven_4_latest`). Anything that needs an actual 
Maven *version* cannot use it, and must not use the raw pattern either. The 
Maven wrapper is the case in point: its `-Dmaven=` becomes a download URL, and
   
   ```
   mvn org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper -Dmaven=4.0.x
   ```
   
   exits **0** and writes
   
   ```
   
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/4.0.x/apache-maven-4.0.x-bin.zip
   ```
   
   which is a 404 (so is `3.9.x`). The failure only shows up later, when 
`./mvnw` tries to download.
   
   `mvnVersionFromPattern` returns a concrete version for the patterns in use, 
passes concrete versions through unchanged, and returns **null** for anything 
it does not recognise — including a stringified list such as `"[4.0.x]"` — so 
callers can fail loudly rather than build an URL that will not resolve. That 
last part matters: `mvnFromVersion` currently falls through to `default: return 
'maven_3_latest'`, which is why a Jenkinsfile passing `siteMvn` as a List has 
been silently running the site stage on Maven 3 in several repos.
   
   Mapping verified by working through each input the Jenkinsfiles actually 
pass; there is no way to execute this shared library locally, so it has not 
been run on Jenkins.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to