$ ./gradlew wrapper --gradle-version 7.0.2
Downloading https://artifactory.company.com/artifactory/gradle-binaries-local/gradle-7.0.2-all.zip
// Note on another URL I do not get 401 error, does the wrapper make any outside firewall calls, can I download and point the URL to a local address???
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL:
https://artifactory.company.com/artifactory/gradle-binaries-local/gradle-7.0.2-all.zip
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at org.gradle.wrapper.Download.downloadInternal(Download.java:83)
at org.gradle.wrapper.Download.download(Download.java:66)
at org.gradle.wrapper.Install$1.call(Install.java:68)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
I don’t think the wrapper
task is accessing any external URLs, it just generates the wrapper properties file and puts the wrapper jar and start scripts from the currently used version in place.
But the gradlew
call starts the wrapper and the wrapper downloads the distribution from the URL configured in the wrapper properties file. This downloaded distribution would then be used to execute the wrapper
task.
Btw. please don’t use the all
distribution, it is a waste of disk-space, time, and bandwidth for anyone executing the build. When using the Kotlin DSL it has no real advantage at all and when using the Groovy DSL it only has a slight advantage for modifying the build to overcome an IDE shortcoming that is worked on hopefully. So please at most use the all
distribution locally while editing the build.
@Vampire thank you so much, still having the build issue and this is for just building locally. When code is committed it is out of my control Jenkins takes over along with Policy (Out of my control).
Well, if you have a paranoid IT department hindering normal working and you must not access your company artifactory to download the Gradle distribution defined in the wrapper but have to use one of the pre-installed versions you mentioned, then don’t use gradlew
, but use gradle
from the installed version with the right version, either by making your PATH ordered correctly or by calling it by full path.