Gradle plugins not able to resolve plugins dependencies

I am encountering an issue with Gradle when attempting to run a task on a Linux server. Despite having the correct Java and Gradle versions configured, I am getting SSL misconfiguration errors when Gradle tries to resolve plugins. Here’s a detailed breakdown of my setup and the error:

Environment:

Gradle version: 8.8
Java version: openjdk version “1.8.0_412”
Java home: Set in /etc/profile as

export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.412.b08-2.el8.x86_64
export PATH=$JAVA_HOME/bin:$PATH

build.gradle:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        flatDir {
            dirs 'lib'
        }
    }
}

plugins {
    id 'com.github.node-gradle.node' version '2.2.0'
    id 'com.marklogic.ml-gradle' version '4.8.0'
}

repositories {
    mavenCentral()
    maven {
        url 'https://developer.marklogic.com/maven2/'
    }
}

configurations {
    mlcp
}

dependencies {
    mlcp 'com.marklogic:mlcp:10.0.9.2'
    mlcp files('lib')
}

node {
    version = '10.5.0'
    npmVersion = '6.1.0'
    download = true
}

Error when running following command

**./gradlew taskname -PmlHost=“localhost” on the linux server, getting following error : **

2024-06-07T18:10:27.221+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {s}->https://plugins.gradle.org:443
2024-06-07T18:10:27.224+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to plugins.gradle.org/ip:443
2024-06-07T18:10:27.224+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to plugins.gradle.org/ip:443 with timeout 30000
> Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
   > Could not get resource 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
      > Could not GET 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
         > Got socket exception during request. It might be caused by SSL misconfiguration
            > Connect to plugins.gradle.org:443 [plugins.gradle.org/104.16.72.101, plugins.gradle.org/104.16.73.101, plugins.gradle.org/2606:4700:0:0:0:0:6810:4865, plugins.gradle.org/2606:4700:0:0:0:0:6810:4965] failed: Network is unreachable (connect failed)

However, when I use curl to check the connection, I get a 200 OK response:

curl -I "https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom"

and same code when I am running on my local system it is work fine
There I am using java version “1.8.0_202”

Why does Gradle fail to resolve the plugin due to an SSL misconfiguration even though curl works fine? How can I resolve this SSL misconfiguration to allow Gradle to successfully connect to the plugin repository?

Any help or insights into this issue would be greatly appreciated!

Why does Gradle fail to resolve the plugin due to an SSL misconfiguration even though curl works fine?

I don’t think it is an SSL misconfiguration.
It says “might be caused by” since 8.3.0, probably because that is a typical cause for that error.
But if you look at the actual error one line below, it says

Network is unreachable (connect failed)

That curl works is just an indication, but not a proof.

I’d guess that you need to use some proxy to access the internet, which is configured for curl, but not for Gradle. See Networking with Gradle for more info on that.

Hi @Vampire , thank you for suggestion

But after using proxy also in gradle.properties:
systemProp.http.proxyHost=proxy
systemProp.http.proxyPort=port
systemProp.https.proxyHost=proxy
systemProp.https.proxyPort=port

getting this error

> Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
     Required by:
         project : > com.github.node-gradle.node:com.github.node-gradle.node.gradle.plugin:2.2.0
      > Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
         > Could not get resource 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
            > Could not GET 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_bf4e8fee0b3de0481a0ab35044e3cd3fd85b9270fc49_IvVXbotm_'.

and in debug mode it showing like this

2024-06-10T13:31:36.827+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection [id: 17][route: {tls}->http://proxy:port->https://plugins.gradle.org:443] can be kept alive indefinitely
2024-06-10T13:31:36.827+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-17: set socket timeout to 0
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 17][route: {tls}->http://proxy:port->https://plugins.gradle.org:443][total available: 1; route allocated: 1 of 20; total allocated: 1 of 20]
2024-06-10T13:31:36.828+0000 [DEBUG] [org.gradle.internal.resource.transport.http.AlwaysFollowAndPreserveMethodRedirectStrategy] Redirect requested to location 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom'
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Resetting target auth state
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Redirecting to 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom' via {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection request: [route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 1; route allocated: 0 of 20; total allocated: 1 of 20]
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection leased: [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 1; route allocated: 1 of 20; total allocated: 2 of 20]
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to proxy/ip:port
2024-06-10T13:31:36.842+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connection established ip1:port1<->ip:port
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Tunnel to target created.
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled protocols: [TLSversion, TLSversion]
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled cipher suites:[]
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Secure session established
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated protocol: TLSvversion
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated cipher suite: TLS
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer principal: CN=plugins-artifacts.gradle.org, O="Cisco Systems, Inc."
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer alternative names: [plugins-artifacts.gradle.org]
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  issuer principal: CN=Cisco Umbrella
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-18: set socket timeout to 30000
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request GET /com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom HTTP/1.1
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Target auth state: UNCHALLENGED
2024-06-10T13:31:36.946+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection can be kept alive indefinitely
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.ResponseProcessCookies] Cookie accepted [X-OpenDNS-Session="830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB", version:0, domain:plugins-artifacts.gradle.org, path:/, expiry:Mon Jun 10 13:36:36 UTC 2024]
2024-06-10T13:31:36.947+0000 [DEBUG] [org.gradle.internal.resource.transport.http.AlwaysFollowAndPreserveMethodRedirectStrategy] Redirect requested to location 'https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com/s/plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB_'
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Resetting target auth state
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Redirecting to 'https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com/s/plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB_' via {tls}->http://proxy:port->https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com:443
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443] can be kept alive indefinitely
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-18: set socket timeout to 0
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 2; route allocated: 1 of 20; total allocated: 2 of 20]
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context

with curl
curl -I ‘https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom
getting this
HTTP/1.1 200 Connection established

HTTP/1.1 303 See Other
Date: Mon, 10 Jun 2024 14:31:00 GMT
Content-Length: 0
Connection: keep-alive

Could you please suggest how will I fix this ?

I have no idea how your proxy needs to be configured, sorry.
Maybe you should seek help from your network administrator.

I have checked with network team as per them proxy is properly configured. we tried to clean .gradle file then ran gradle command to install gradle wrapper, it is installing that correctly, which we do not work without proxy and also there is nothing in debug that shows connection not successful, we have gone through it and found nothing like that but in end it throwing that exception and when using wget to same url, the pom and jre file are downloaded successfully.
In our company we are using cisco umbrella, is it be the one behind it as I gone through one of discussion page on discuss.gradle.org which Download Wrapper fails with SSLHandshakeException stacktrace - #5 by DJViking.

Any insights or suggestions would be greatly appreciated.

I’m sorry, but from remote I have no idea. If you think the proxy is configured properly but it does not work, maybe it is some uncommon proxy setup that is not supported or buggy. In that case it might make sense to open an issue ticket on GitHub.