marklogic / ml-gradle

Gradle plugin for automating everything involving MarkLogic
Other
72 stars 77 forks source link

Gradle plugins not able to resolve plugins dependencies #697

Closed ravichoudhary1412 closed 3 months ago

ravichoudhary1412 commented 3 months ago

I encounter an issue with Gradle when attempting to run a task on a Linux server. Despite configuring the correct Java and Gradle versions, I get errors when Gradle tries to resolve plugins. Here's a detailed breakdown of my setup and the error:

Linux 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 :

A problem occurred configuring root project 'redaction'.
> Could not resolve all artifacts for configuration ':classpath'.
   > 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=_850b71cf0c48e04902097a60b09b5f15dfa19270fc47_HRuoOzdJ_'.

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

wget 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=_850b71cf0c48e04902097a60b09b5f15dfa19270fc47_HRuoOzdJ_

and same code when I am running on my local system it is work fine There(window system) I am using java version "1.8.0_202"

Note : we are also using proxy in our case and save the proxy configuration in gradle.properties

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

rjrudin commented 3 months ago

Your error is for getting gradle-node-plugin, which doesn't have anything to do with ml-gradle.

Assuming you'd get the same error for ml-gradle though if you remove gradle-node-plugin from your build.gradle file, it certainly sounds like an issue with your proxy configuration. I recommend trimming your build.gradle file down to a single plugin - start with just the gradle-node-plugin - and use that to debug the problem with your proxy settings.

I am closing this ticket because the problem is outside the scope of ml-gradle, and likely outside the scope of gradle-node-plugin as well. For the general problem of "Unable to download Gradle plugins when using a proxy server", I recommend looking into the Gradle documentation and forums for support.