Global gradle proxy settings?

Yes it seems possible. See here, especially:

We can define a gradle.properties file and set the property in this file. We can place the file in our project directory or in the <USER_HOME>/.gradle directory. The properties defined in the property file in our home directory take precedence over the properties defined in the file in our project directory. As a bonus we can also define system properties in a gradle.properties file, we only have to prefix the property name with systemProp..

The gradle.properties files can be found at the following paths:

# windows gradle file
%userprofile%\.gradle\gradle.properties

# linux gradle file
~/.gradle/gradle.properties 

Copy & paste:

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080

to gradle global config = current user's gradle.properties

  • Linux/Mac/Unices: $HOME/.gradle/gradle.properties
    • eg: /Users/limao/.gradle/gradle.properties
  • Windows: %userprofile%\.gradle\gradle.properties

More details refer official doc Accessing the web through a HTTP proxy

Thanks to @Opal's answer, @fty4


Also do not forget the no proxy setting for the exception list, just in case

systemProp.https.nonProxyHosts=artifactory.yourCompany.com|localhost|*.nonproxyrepos.com

Tags:

Java

Gradle