guava:32.1.1-jre conflicts with google-cloud-datastore:2.16.0 (original) (raw)

Using gradlew 7.4, this build.gradle file:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.google.cloud:google-cloud-datastore:2.16.0'
    implementation 'com.google.guava:guava:32.1.1-jre'
}

print configurations.runtimeClasspath.files

...fails like this:

$ gradlew dependencies

FAILURE: Build failed with an exception.

* Where:
Build file '/tmp/gradle-guava-error/build.gradle' line: 13

* What went wrong:
A problem occurred evaluating root project 'test'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Could not resolve com.google.guava:guava:32.1.1-jre.
     Required by:
         project :
      > Module 'com.google.guava:guava' has been rejected:
           Cannot select module with conflict on capability 'com.google.guava:listenablefuture:1.0' also provided by [com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava(runtime)]
   > Could not resolve com.google.guava:guava:31.0.0-jre.
     Required by:
         project :
      > Module 'com.google.guava:guava' has been rejected:
           Cannot select module with conflict on capability 'com.google.guava:listenablefuture:1.0' also provided by [com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava(runtime)]
   > Could not resolve com.google.guava:guava:32.0.1-jre.
     Required by:
         project : > com.google.cloud:google-cloud-datastore:2.16.0
      > Module 'com.google.guava:guava' has been rejected:
           Cannot select module with conflict on capability 'com.google.guava:listenablefuture:1.0' also provided by [com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava(runtime)]
   > Could not resolve com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava.
     Required by:
         project : > com.google.cloud:google-cloud-datastore:2.16.0
         project : > com.google.cloud:google-cloud-datastore:2.16.0 > com.google.api.grpc:grpc-google-cloud-datastore-admin-v1:2.16.0
      > Module 'com.google.guava:listenablefuture' has been rejected:
           Cannot select module with conflict on capability 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' also provided by [com.google.guava:guava:32.1.1-jre(jreRuntimeElements)]

* 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 314ms

It succeeds with 32.0.1-jre or if excluding the transitive listenablefuture dependency from datastore:

    implementation dependencies.create('com.google.cloud:google-cloud-datastore:2.16.0') {
        exclude group: 'com.google.guava', module: 'listenablefuture'
    }