Bug Description
In the Maven wrapper script (mvnw), there's a bug where single quotes around shell built-ins prevent Java detection from working properly.
The following code in mvnw:
JAVACMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v java
)" || :
JAVACCMD="$(
'set' +e
'unset' -f command 2>/dev/null
'command' -v javac
)" || :
Should be fixed by removing the single quotes:
JAVACMD="$(
set +e
unset -f command 2>/dev/null
command -v java
)" || :
JAVACCMD="$(
set +e
unset -f command 2>/dev/null
command -v javac
)" || :
Impact
With the quotes, the shell literally looks for executables called set, unset, and command, which do not exist. This causes the command substitution to fail and JAVACMD/JAVACCMD remain empty. As a consequence, the Java-based download fallback will never be selected even when wget/curl are missing.
References
Bug Description
In the Maven wrapper script (
mvnw), there's a bug where single quotes around shell built-ins prevent Java detection from working properly.The following code in
mvnw:Should be fixed by removing the single quotes:
Impact
With the quotes, the shell literally looks for executables called
set,unset, andcommand, which do not exist. This causes the command substitution to fail andJAVACMD/JAVACCMDremain empty. As a consequence, the Java-based download fallback will never be selected even whenwget/curlare missing.References