Repository navigation
Fail fast when no download mechanism is available in mvnw - #462
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
The download block in only-mvnw tries wget, then curl, then falls back to Java, but had no final else. When none of the three are available, the if/elif chain silently falls through instead of failing, and the script only reports a confusing "failed to unzip" error from the later unzip step, which can never find a distribution archive that was never downloaded. Adds the missing else branch to fail immediately with a clear message, and a guard right after the download block that fails if the distribution file does not exist, before any further processing. Fixes apache#441.
arturobernalg
force-pushed
the
fix/mwrapper-441-no-download-mechanism
branch
from
October 19, 2026 11:39
4f44c30 to
ff8327e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The download block in only-mvnw tries wget, then curl, then falls back to Java, but had no final else. When none of the three are available, the if/elif chain silently falls through instead of failing, and the script only reports a confusing "failed to unzip" error from the later unzip step, which can never find a distribution archive that was never downloaded.
Adds the missing else branch to fail immediately with a clear message, and a guard right after the download block that fails if the distribution file does not exist, before any further processing. Fixes #441.
What
Fixes #441:
mvnw(generated withdistributionType=only-script) silently continues when none of wget, curl or a JDK are available to download the Maven distribution, instead of failing with a clear message.How
elseto the wget/curl/Java download dispatch inonly-mvnw, callingdiewith a message naming the three possible download mechanisms.Tests
only-mvnwwithPATHstripped ofwget/curl/java/javacandJAVA_HOMEunset against a realmaven-wrapper.properties. Before the fix it printed the JAVA_HOME warning and then failed later with a confusingunzip: cannot find or open ... failed to unzip(exit 1). After the fix it fails immediately withNo download mechanism available: install wget or curl, or make a JDK available on PATH / via JAVA_HOME(exit 1).PATH(curl available): downloads and runs Maven 3.9.9 successfully, no regression.sh -n only-mvnw: syntax OK.To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
check one of the following: