arturobernalg opened a new pull request, #466: URL: https://github.com/apache/maven-wrapper/pull/466
Fixes #410. MavenWrapperMain boots the downloaded Maven distribution's classworlds launcher by reflection inside the same JVM that mvnw starts, so none of that distribution's own bin/mvn script (which already probes for and adds --enable-native-access=ALL-UNNAMED, see MNG-8248) ever runs. On JDK 22+, when Jansi loads its native library, the JVM prints "WARNING: A restricted method in java.lang.System has been called" for an mvnw run but not for a direct mvn run, since the real bin/mvn already carries the flag. This ports the same probe already used by bin/mvn and bin/mvn.cmd: try the flag first and only add it when the running JDK understands it, so older JDKs that reject it as an unrecognized option keep working exactly as before. Verified on JDK 8, 17 and 26 (Linux) with a generated wrapper: the flag is omitted on 8, added on 17/26, and ./mvnw -v succeeds in all three cases. The warning itself only reproduces on Windows (Jansi's native console support), so I could not observe the warning text disappearing on this machine, but the mechanism and the script-level fix are directly verified. only-mvnw / only-mvnw.cmd exec the distribution's own bin/mvn directly, so they already carry the flag through that script and need no change. mvnwDebug / mvnwDebug.cmd delegate to mvnw / mvnw.cmd and inherit the fix. Full module build and tests pass. -- 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]
