The solution offered by M.P. Korstanje did not work for me directly, b/c my version of Nexus does not allow me to proxy raw websites. However, I was able to achieve similar functionality by creating a Hosted "Site" repository, and then uploading the Gradle bin zips to my repo with this script:
#/bin/bash
#
# This helper script will upload any file to 'Gradle Distributions' Nexus repo
#
NEXUS_ADMIN_USER=$1
GRADLE_BIN_ZIP_FILE=$2
if [ -z "$NEXUS_ADMIN_USER" ] \
|| [ -z "$GRADLE_BIN_ZIP_FILE" ]
then
echo "$0 <NEXUS_ADMIN_USER> <GRADLE_BIN_ZIP_FILE>"
exit 1
fi
curl -v \
--user $NEXUS_ADMIN_USER \
--upload-file $GRADLE_BIN_ZIP_FILE \
http://nexus-host:8081/nexus/content/sites/gradle-distributions/$GRADLE_BIN_ZIP_FILE
So now all of the approved Gradle distros are available at a Nexus-managed URL:
http://nexus-host:8081/nexus/content/sites/gradle-distributions/
├── gradle-3.5.1-bin.zip
├── gradle-7.4.1-bin.zip
├── gradle-7.4.2-bin.zip
└── upload_gradle_distro.sh
The last step is to modify gradle/wrapper/gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=http\://nexus-host\:8081/nexus/content/sites/gradle-distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists