Gradle: Behind Proxy Server

Create a file in your project root directory call gradle.properties. Assume your proxy server is my.proxy.com, with port 8080, and your user name is USERNAME, and password is PASSWORD:

systemProp.http.proxyHost=my.proxy.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=USERNAME
systemProp.http.proxyPassword=PASSWORD

systemProp.https.proxyHost=my.proxy.com
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=USERNAME
systemProp.https.proxyPassword=PASSWORD

Gradle will automatically pick these setting up, and download your project dependencies if needed.

For IntelliJ Gradle Wrapper

Go to the directory ./gradle/wrapper/. Open gradle-wrapper.properties. Add the above code at the end of this setting file with your own host, port, login, and password.