http8086
http8086

Reputation: 1686

How to prevent gradle from using proxy in IntelliJ IDEA?

IntelliJ IDEA preference setting No proxy, let me repeat No proxy, but sync gradle, I found gradle still took proxy setting, No kidding.

IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
Licensed to IntelliJ IDEA Evaluator
Expiration date: August 19, 2019
JRE: 1.8.0_202-release-1483-b58 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.5

How do I know gradle is using proxy, let's see

***VERT LONG LONG STACK BACKTRACE***
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused (Connection refused)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
    ... 190 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    ... 202 more

what is 127.0.0.1:1087, that is my local proxy server shadowsocks client agent, I once did the setting in preference for fetching things blocked by our great fire wall, but THIS TIME, I set No proxy in preference, also I investigated environment variables in case of env dependency things, but there is not such proxy setting in env either, I just want the No proxy setting in preference should be honored, why is that so hard?

Upvotes: 0

Views: 1988

Answers (1)

Habib Kazemi
Habib Kazemi

Reputation: 2190

When you add proxy in the intellij IDEA it automatically adds the proxy in gradle.properties but when you remove it from settings it's still there. open gradle.properties and remove the proxy.

It should be something like this:

systemProp.http.proxyHost=your_proxy_http_host
systemProp.http.proxyPort=your_proxy_http_port
systemProp.https.proxyHost=your_proxy_https_host
systemProp.https.proxyPort=your_proxy_https_port

There are 3 places gradle.properties can be placed (if an option is configured in multiple locations the last one wins)

gradle.properties in Gradle installation directory.

gradle.properties in project root directory.

gradle.properties in GRADLE_USER_HOME directory. (if you did not set GRADLE_USER_HOME in your environment variable, the default is USER_HOME/.gradle)

You can read more about it here

Upvotes: 1

Related Questions