Does Gradle use proxy?

Answered

I am in a corporate network and I need to use a proxy. Under “HTTP Proxy” I settings I've set a manual proxy and when test https://plugins.gradle.org/ from “Check connection” it prints “connection successful”.

However when I click “Load Gradle Changes” button it cannot download org.springframework.boot 2.6.1.  Logs show that it cannot connect to plugins.gradle.org:

[DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connect to plugins.gradle.org/104.17.128.37:443 timed out. Connection will be retried using another IP address
[DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to plugins.gradle.org/104.17.129.37:443
[DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to plugins.gradle.org/104.17.129.37:443 with timeout 30000
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.6.1/org.springframework.boot.gradle.plugin-2.6.1.pom'.

Thus, my question is: Does Gradle use proxy?

0
2 comments

Hi - are you able to see the contents of the XML file if you open https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/2.6.1/org.springframework.boot.gradle.plugin-2.6.1.pom in your browser?

You might need to configure the proxy in Gradle settings. Please refer to Gradle documentation: https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy 

Make sure gradle clean build works from the command line for this project. If it does, then it should work in the IDE too.

0

Arina Efremova yes I can see the content of that link in my browser. My browser uses proxy too.

I think Gradle doesn't use the proxy set on IntelliJ IDEA. I was able to solve my problem by putting the following settings into these two files: C:\Users\<myUserName>\IdeaProjects\<myProject>\gradle.properties and C:\Users\<myUserName>\.gradle\gradle.properties

systemProp.http.proxyHost=proxy.company.internal
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.company.internal
systemProp.https.proxyPort=8080

 

1

Please sign in to leave a comment.