How to set proxy url with gradle

4.1k views Asked by At

I would like to know how to set the proxy url with gradle build system. My proxy url is of the form http://host/proxy.pac

2

There are 2 answers

0
J.E.Tkaczyk On

There are three basic steps: 1) get the PAC URL, 2) get the PAC file from the URL, write/edit a text file gradle.properties.

You can get the proxy host name and port number as follows: Go to CHROME Settings>advanced>System>Open proxy settings>Connections Tab>LAN Settings. The auto-detect URL looks something like this: something.something.company.com/pac.pac. I believe OP's question starts from this point.

Put this URL in your browser address bar and view the resulting PAC (i.e. text) file (for example using notepad) The Proxy listed in that text file is something like this: something.something.org The port is an integer, such as 80 or 8080

Finally add these two lines to a text file called gradle.properties and place that file into you root directory for the project. See this link for more info about that.

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
0
Jorge On

Probably you have figured this out already, but you can check the documentation for the different ways of doing this: https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy