Giter Club home page Giter Club logo

Comments (3)

LiYing2010 avatar LiYing2010 commented on June 9, 2024 2

oh~~~
good news

this workaround works for our real project: 😅

    dependencies {
        modules {
            // replace old dependency `google-collections` with `guava`
            module("com.google.collections:google-collections") {
                replacedBy("com.google.guava:guava", "google-collections is part of guava")
            }
        }
    }

looks like it also applied to the transitive dependency of checkstyle plugin

now our project works just fine ~~~

from guava.

LiYing2010 avatar LiYing2010 commented on June 9, 2024

I reproduced this issue with a very simple build script:

build.gradle.kts:

plugins {
    java
}

repositories {
    mavenCentral()
    maven { setUrl("https://repo.maven.apache.org/maven2") }
}

dependencies {
    implementation("com.google.guava:guava:31.1-jre")
    implementation("com.google.collections:google-collections:1.0")
}

and tested for some versions:
32.0.0-jre ---> works fine
32.0.1-jre ---> works fine
31.1-jre ---> works fine

32.1.0-jre ---> failed with same error
32.1.1-jre ---> failed with same error
32.1.2-jre ---> failed with same error
32.1.3-jre ---> failed with same error

error message is:

Could not resolve: com.google.guava:guava:32.1.0-jre
Could not resolve: com.google.collections:google-collections:1.0
Could not resolve: com.google.guava:guava:32.1.0-jre
Could not resolve: com.google.collections:google-collections:1.0

from guava.

LiYing2010 avatar LiYing2010 commented on June 9, 2024

oh

I found this in your release note:

Reporting dependencies that overlap with Guava
If your dependency graph contains the very old google-collections or the hacky listenablefuture, Gradle will now report that those libraries contain duplicates of Guava classes. When this happens, you'll need to tell Gradle to select Guava:

configurations.all {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
// and/or
resolutionStrategy.capabilitiesResolution.withCapability("com.google.guava:listenablefuture") {
select("com.google.guava:guava:0")
}
}

I added the following to my test build script:

configurations.all {
    resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
        select("com.google.guava:guava:0")
    }
}

and it fixed the dependencies conflict in that test build script

but I am confused, is this a workaround? or the official solution?

also, this does NOT work for our real project,
because google-collections is not a dependency of our project, but a transitive dependency of checkstyle plugin

I don't know how to tell gradle to select guava over google-collections in plugin dependency

from guava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.