Issue Description
When running the Maven wrapper on systems without the unzip command installed, the wrapper fails to properly install Maven.
Technical Details
The issue occurs in mvnw script when it detects unzip is unavailable and switches to using .tar.gz format:
# select .zip or .tar.gz
if ! command -v unzip >/dev/null; then
distributionUrl="${distributionUrl%.zip}.tar.gz"
distributionUrlName="${distributionUrl##*/}"
fi
However, the script doesn't update the distributionUrlNameMain variable which was derived earlier from the original filename. This variable is used later for directory operations, causing the installation to fail on systems without unzip.
Suggested Fix
Update the code to recalculate distributionUrlNameMain after changing the file extension:
- distributionUrl="${distributionUrl%.zip}.tar.gz"
- distributionUrlName="${distributionUrl##*/}"
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
+ distributionUrlName="${distributionUrl##*/}"
+ # keep the "main" name in sync with the new extension
+ distributionUrlNameMain="${distributionUrlName%.*}"
+ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
References
Issue Description
When running the Maven wrapper on systems without the
unzipcommand installed, the wrapper fails to properly install Maven.Technical Details
The issue occurs in
mvnwscript when it detectsunzipis unavailable and switches to using.tar.gzformat:However, the script doesn't update the
distributionUrlNameMainvariable which was derived earlier from the original filename. This variable is used later for directory operations, causing the installation to fail on systems withoutunzip.Suggested Fix
Update the code to recalculate
distributionUrlNameMainafter changing the file extension:References