Issue Description
The Maven Wrapper script (mvnw) documents MVNW_USERNAME and MVNW_PASSWORD environment variables for authentication, but these variables aren't actually used in the wget or curl commands that download the Maven distribution.
This means that private repositories requiring authentication cannot be accessed.
Note: These scripts are generated using mvn -N wrapper:wrapper -Dmaven=3.9.9 from the official Apache Maven Wrapper project. This issue should be reported upstream to the Maven Wrapper project rather than fixed in this repository.
Suggested Fix (for upstream)
Update the wget and curl commands in the Maven wrapper script to use the authentication variables:
For wget:
- wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} \
+ ${MVNW_USERNAME:+--user="$MVNW_USERNAME"} \
+ ${MVNW_PASSWORD:+--password="$MVNW_PASSWORD"} \
+ "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" \
+ || die "wget: Failed to fetch $distributionUrl"
For curl:
- curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L \
+ ${MVNW_USERNAME:+-u "${MVNW_USERNAME}:${MVNW_PASSWORD}"} \
+ -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" \
+ || die "curl: Failed to fetch $distributionUrl"
References
Action Items
This small change would restore the advertised functionality without altering behavior for public downloads.
Issue Description
The Maven Wrapper script (
mvnw) documentsMVNW_USERNAMEandMVNW_PASSWORDenvironment variables for authentication, but these variables aren't actually used in thewgetorcurlcommands that download the Maven distribution.This means that private repositories requiring authentication cannot be accessed.
Note: These scripts are generated using
mvn -N wrapper:wrapper -Dmaven=3.9.9from the official Apache Maven Wrapper project. This issue should be reported upstream to the Maven Wrapper project rather than fixed in this repository.Suggested Fix (for upstream)
Update the
wgetandcurlcommands in the Maven wrapper script to use the authentication variables:For
wget:For
curl:References
Action Items
This small change would restore the advertised functionality without altering behavior for public downloads.