1

I have a gradle Project where I have a dependency on "hudson-core 3.3.3"

compile group: 'org.eclipse.hudson', name: 'hudson-core', version: '3.3.3'

This works without a problem when using Gradle 5.6.2

When I upgrade to Gradle 6.0.1 I receive the following error:

Could not resolve org.eclipse.hudson:hudson-remoting:3.0.3.
 Required by:
     project : > org.eclipse.hudson:hudson-core:3.3.3
     project : > org.eclipse.hudson:hudson-core:3.3.3 > org.eclipse.hudson:hudson-cli:3.3.3
  > Could not resolve org.eclipse.hudson:hudson-remoting:3.0.3.
     > inconsistent module metadata found. Descriptor: org.eclipse.hudson:hudson-remoting:3.0.4-SNAPSHOT Errors: bad version: expected='3.0.3' found='3.0.4-SNAPSHOT'

The Repository is always the same:

repositories {
mavenCentral()
maven {
    url 'http://repo.jenkins-ci.org/public/'
}

}

Any Ideas why this error happens?

Christoph Forster
  • 1,728
  • 4
  • 27
  • 39
  • I "fixed" the problem by manually modifying the "hudson-remoting-3.0.0.pom" and set Version to "3.0.3" within the Gradle Cache but that can not be the final solution ... – Christoph Forster Jan 14 '20 at 15:03

3 Answers3

2

As said by @ToYonos, the problem is in the dependency itself.

Not perfect solutions, but 2 workarounds can be done as explained in Gradle's documentation (v6.7.1):

  1. Exclude that transitive dependency, for example in the current Gradle versions using implementation instead of compile:

    implementation('org.eclipse.hudson:hudson-core:3.3.3') { 
        exclude group: 'org.eclipse.hudson'
        exclude module: 'hudson-remoting'
    }
    
  2. Override that transitive dependency version:

    implementation('org.eclipse.hudson:hudson-remoting') {
        version {
            strictly '3.0.2' // As 3.0.3 is having the issue
        }
    }
    
froblesmartin
  • 1,527
  • 18
  • 25
1

In the pom.xml file of hudson-remoting 3.0.3, the version is <version>3.0.4-SNAPSHOT</version>

The issue is quite clear.

I tried with an old Gradle 4.4.1 and I am having the exact same issue. Likewise with Gradle 5.1.1 and your version, 5.6.2

I'm quite sure that if you clean your artefact cache for Gradle 5.6.2, it won't work anymore.

The error is on the repository side.

ToYonos
  • 16,469
  • 2
  • 54
  • 70
  • Yes, Issue is clear but I was not able to reproduce the problem with Gradle 5.6.2 even after cleaning the cache. I solved the problem by getting rid of the dependency as it was last modified in 2014 and I don't think that pom.xml error will be fixed in near future. Thx for the fast response – Christoph Forster Jan 14 '20 at 15:26
1

Another option is to define a repository that will download only a jar:

repositories {
    mavenCentral() {
        name = "Download only jar repo"
        metadataSources { artifact() }
        content {
            // Use this repository only for org.eclipse.hudson:hudson-remoting
            includeVersion("org.eclipse.hudson", "hudson-remoting", "3.0.3")
        }
    }
    mavenCentral()
}

Also since pom is not downloaded you would have to add hudson-remoting dependencies by hand to build.gradle. But luckily for this particular case hudson-core already contains the only dependency commons-codec:commons-codec:1.4 that hudson-remoting needs, so this is not needed.

Note: the order of repositories is important, although in that case it will work either way. If you don't want to care about the order when using repositories with filter check exclusive content filtering.