Intellij IDEA - gradle wrapper recognizes proxies, gradle doesn't

(Francesco Quadrelli) #1

I’m in a complex corporate network, where the proxies are configured through a pac file (updated regurarly).
Intellij IDEA automatically configure its proxy settings via the pac file and the connection works (I can, for instance, check for updates).
Gradle wrapper, somehow, is able to get the current proxy configuration from Intellij IDEA and dowload the gradle version specified in the
On the other hand, gradle can’t connect to jcenter to download the requested dependencies.
I can set the property “systemProp.https.proxyHost” with a proxy, but this is just a temporary solution, because the host can change in the next pac update.
How can I tell gradle to get the configuration from Intellij IDEA or, alternatively, directly from the pac file?

(Dimitar Dimitrov) #2

Idea can be very helpful, often to the point of masking build failure. In this case it downloads the distribution from its main jvm and reuses the proxy settings, but the same build would fail if ran from the command line or a CI server.

The typical approach to your problem is to setup a local Artifactory or Nexus and use them to download Gradle distributions and dependencies. You would like to specify repositories in a custom Gradle init file either per user or as part of repackaged Gradle distribution.

Alternatively, you may use something like the proxy-vole library to parse the pac file and choose the right proxy. This is non-standard solution and would force you to learn more about Gradle than you ever wanted to know :slight_smile: