I tried enabling the --debug
flag but everything looked ok and the plugin POM seemed to be accessible with no error (and was accessible in the browser):
2024-01-30T11:08:08.507+1100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Download https://plugins.gradle.org/m2/com/gorylenko/gradle-git-properties/com.gorylenko.gradle-git-properties.gradle.plugin/2.4.0/com.gorylenko.gradle-git-properties.gradle.plugin-2.4.0.pom'
Immediately after that log I got the error posted in the original comment with no details of the cause.
If I commented out all the plugins and ran Gradle again, all the other dependencies were downloaded fine so it just seemed to be plugins.
What I had forgotten is that our organisation requires a security proxy on company laptops that uses its own Man-in-the-Middle Certificate which is not trusted by anything by default and must be installed wherever needed.
Similarly to one of the other commenters, adding the proxy certificates to $JAVA_HOME/lib/security/cacerts
fixed the issue.
I have no idea why downloading dependencies worked and can only surmise that Gradle is inconsistent in checking for self-signed certificates.