Skip to content

Gradle proxy config passed via gradle.properties seems to be ignored by Gradle #30083

Description

@FBibonne

Current Behavior

When I provide the configuration for my corporate proxy inside the $GRADLE_USER_HOME/gradle.properties the build fails because Gradle can downloads dependencies because it requests the proxy on the bad port (443 instead of 8080).

Here is a copy of my gradle.properties file (IP masked) :

systemProp.http.proxyHost=1**.**.**.201
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=1**.**.**.201
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=*.mycompany.test|*.mycompany.fr|*.mycompany.eu|*.mycompany.intra|localhost|127.*|[::1]

The build command that I run : gradle build

The output of the failed build :

Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Build file '/home/fabrice/DEPOTS/SNDIL/Eno/build.gradle' line: 3

* What went wrong:
Plugin [id: 'org.springframework.boot', version: '3.2.0', apply: false] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    MavenRepo

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1m 37s

Notice that 443 is the default value of https.proxyPort property.

Expected Behavior

Gradle should download dependencies and the build should succeed as in my workaround.

Workaround :

I run this command gradle build -Dhttps.proxyPort=8080 and the build succeeds :

BUILD SUCCESSFUL in 22s
28 actionable tasks: 12 executed, 16 up-to-date

Context (optional)

I just need to build a java application with gradle behind a corporate proxy which process https requests on the good proxy port.

Steps to Reproduce

  • Stay behind a corporate proxy which does not use the port 443 to process https requests
  • Get a clean installation of Gradle 8.9 (with sdkman for example)
  • Clone this project : https://github.com/InseeFr/Eno
  • Do not open it in your IDE
  • Try to run gradle build --debug
  • the build is going to fail while downloading the first dependency with this kind of stack trace inside the logs (proxy IP masked) :
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to 1**.**.**.201:443 [/1**.**.**.201] failed: Connect timed out
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:401)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:201)
        at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:177)
        at org.gradle.internal.resource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.java:166)
        at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:114)
        ... 259 more
Caused by: java.net.SocketTimeoutException: Connect timed out
        at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
        at java.base/java.net.Socket.connect(Socket.java:751)
        at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
        ... 271 more

NB : I get similar issue whith the wrapper when the wrapper tries first to download the Gradle binary

Gradle version

8.9

Build scan URL (optional)

No response

Your Environment (optional)

  • Ubuntu 24.04 on WSL
  • java version 21.0.3-tem (installation from sdkman)
  • gradle 8.9 installed by sdkman

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugThis doesn't work as expectedin:build-environmentGradle, project, system and environment properties, CLI flags🌳 help wantedTaking contributor PRs, might need existing Gradle knowledge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions