Execute Gradle behind a corporate proxy network

This is the easiest way I found to handle Gradle under a network proxy.

In the root project that used Gradle, create a file gradle.properties , add the following config values

systemProp.{PROTOCOL}.proxyHost={PROXY_HOST}systemProp.{PROTOCOL}.proxyPort={PROXY_PORT}systemProp.{PROTOCOL}.nonProxyHosts={NON_PROXY_HOSTS}

Replace the value marked by braces with appropriate values. For example, following is the config for HTTP and HTTPS protocols,

systemProp.http.proxyHost=10.10.0.100systemProp.http.proxyPort=8888systemProp.http.nonProxyHosts=localhost|127.0.0.1|10.10.1.*systemProp.https.proxyHost=10.10.0.100systemProp.https.proxyPort=8888systemProp.https.nonProxyHosts=localhost|127.0.0.1|10.10.1.*

Afterward, run regular Gradle commands, it will automatically load this config for proxies.

For global configuration, just put that gradle.properties to Gradle home directory, which is usually at $HOME/.gradle

Have fun :)

--

--

Code / Design / Love @ https://petehouston.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store