ASIF KAMRAN MALICK
08/27/2024, 11:14 AMException in thread "main" java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: <the distributionUrl>
NOTE: I had earlier worked around this wrapper download issue by manually downloading the wrapper on my system(as download ), copying the distribution to the environment X and putting it in the distributionPath
By doing so I was able to get the gradle wrapper being recognized and unzipped successfully. However the project build kept failing because the dependencies could no more be downloaded and threw HTTP 401 error. I was able to successfully build the project after passing credentials to my repository configurations. But the wrapper download issue still exists.
UPDATE:
I discovered that we had been carrying over a pretty old gradle-wrapper.jar. When I replaced it with a more recent one(6.8.3) it started working out of the box and the wrapper was getting downloaded.
But I also noticed that for older gradle-wrapper.jar files the output result differed when downloading the corresponding Gradle wrapper:
using the gradle-wrapper.jar for Gradle 2.5 : error was HTTP 401,
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL: <distribution-url-goes-here>
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:59)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
using the gradle-wrapper.jar for Gradle 3.5.1 and any later versions : PASSED
I'm testing with above wrapper jars against the distributions Gradle 2.6(trying to upgrade a pretty old build)ASIF KAMRAN MALICK
08/29/2024, 7:33 PM