anar chipur
anar chipur

Reputation: 141

Gradle works with proxy settings but Gradle-wrapper does not. Why?

I have a Gradle 5.0 installation on windows 10. I use a proxy, so I put the proxy information into gradle.properties in the bin subdirectory of the gradle installation:

systemProp.http.proxyHost=myproxyserver
systemProp.http.proxyPort=myport
systemProp.http.proxyUser=myuser
systemProp.http.proxyPassword=mypassword

systemProp.https.proxyHost=myproxyserver
systemProp.https.proxyPort=myport
systemProp.https.proxyUser=myuser
systemProp.https.proxyPassword=mypassword

I created a simple java project with build.gradle. Executing gradle build works. However executing ./gradlew build tries to download the gradle zip file as in the gradle-wrapper.properties and generates an exception:

Exception in thread "main" java.net.ConnectException: Connection timed out: connect

So I put the above proxy settings at the beginning of the gradle-wrapper.properties file. However gradlew build still generates the same exception.

I checked other posts and could not find a solution for this particular problem. Could you help me make this work?

Upvotes: 3

Views: 4405

Answers (1)

tryman
tryman

Reputation: 3293

Copy paste your question's code in a new file inside your root project named "gradle.properties".
As an alternative, you can also add it inside your buildscript, as described in the relevant section of the gradle docs.

The file gradle/wrapper/gradle-wrapper.properties contains info about the wrapper itself and it is different from the file gradle.properties in your project's root folder. If you have modified that it would be best to return it to its original state.

Upvotes: 1

Related Questions