Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use socks with gradle for dependency resolving, in command line?

Tags:

gradle

socks

When jcenter is not accessible without proxy server, to resolve dependencies, and i want to use socks instead of http proxy, how i can use it in commanad line? I know how to use http proxy:

-Dhttp.proxyHost=yourProxy -Dhttp.proxyPort=yourPort  
-Dhttp.proxyUser=usernameProxy -Dhttp.proxyPassword=yourPassoword
like image 402
M.Kouchi Avatar asked Apr 19 '16 06:04

M.Kouchi


People also ask

How do I change the proxy settings in IntelliJ gradle?

Configure proxy settings directly from IntelliJ IDEA. Do the following: Open the Version Control | Subversion | Network page of the IDE settings Ctrl+Alt+S . Click the Edit Network Options button and specify the proxy settings in the Edit Subversion Options Related to Network Layers dialog that opens.


2 Answers

Gradle only documents about how to use HTTP(s) proxy, however in the ant source code it mentions, there is enough information about how to setup the SOCKS proxy.

Add the following two lines to the gradle.properties configuration file and you are done.

systemProp.socksProxyHost=your socks proxy ip
systemProp.socksProxyPort=your socks proxy port

The format of SOCKS configuration names (socksProxyHost and socksProxyPort) differs from HTTP proxy host and port configurations (http.proxyHost and http.proxyPort).

like image 155
coinfaces Avatar answered Oct 19 '22 15:10

coinfaces


I found answer, here you can use:

./gradlew -DsocksProxyHost=yourHost 
-DsocksProxyPort=yourHostPort your-command

using above you can set socks host and port.

like image 35
M.Kouchi Avatar answered Oct 19 '22 15:10

M.Kouchi