rmannibucau opened a new pull request, #476:
URL: https://github.com/apache/maven-wrapper/pull/476

   Rework the standalone `only-mvnw` script so it no longer depends on the 
external `unzip` or `tar` commands. Extraction now relies solely on `jar`, 
which ships with the JDK, and the executable bit on the Maven launcher scripts 
is re-applied after extraction.
   
   ## What and why
   
   The standalone `only-mvnw` distribution script currently uses:
   
   - `unzip` when available, falling back to `tar xzf` otherwise, and a `.zip` 
-> `.tar.gz` distribution fallback when `unzip` is absent;
   - no handling of the unix executable bit, so freshly installed `bin/mvn` / 
`bin/mvnd.sh` may lack `+x`.
   
   This removes the external tooling dependency and guarantees a usable Maven 
install.
   
   ## Changes
   
   - Resolve and require `JARCMD` alongside `JAVACMD`/`JAVACCMD` in 
`set_java_home` (`JAVA_HOME/bin/jar`, with the `JAVA_HOME/jre/bin/jar` layout 
for AIX/IBM JDK).
   - Invoke `set_java_home` unconditionally before downloading, so the JDK (and 
therefore `jar`) is available even when `wget` or `curl` performs the download.
   - Always select the `.zip` distribution: drop the `.tar.gz` fallback and the 
`__MVNW_QUIET_UNZIP`/`__MVNW_QUIET_TAR` quiet variables.
   - Extract with `jar xf` in a subshell `cd` that honors `MVNW_VERBOSE`.
   - `chmod +x` `bin/$MVN_CMD` after extraction, on all unix-like hosts 
including Cygwin/MinGW, where the launchers are shell scripts and `jar` does 
not preserve the exec bit.
   
   The change applies only to the POSIX-sh script. `mvnw` already delegates 
extraction/chmod to the Java Installer, and `only-mvnw.cmd` relies on 
PowerShell `Expand-Archive`, so those need no change.
   
   ## Validation
   
   - `shellcheck 0.10.0` passes (`-e SC1091 -e SC2009`); `dash -n` and `bash 
--posix -n` are clean.
   - Functional extract + chmod verified under `dash` and `bash` with 
`unzip`/`tar` absent from `PATH`.
   - Invoker ITs `type_only-script` and `sh_type_only-script` pass (Maven 
4.0.0-rc-7 under JDK 17): fresh download via `wget`, `jar` extraction, 
`bin/mvn` installed with `rwxr-xr-x`.
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).


-- 
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