0

I'm trying to debug why Gradle is picking up r2dbc-spi:0.8.6.RELEASE when it is not brought transitively by any dependency. The output of ./gradlew :proj:dependencyInsight --dependency r2dbc-spi --configuration runtimeClasspath is the folowing:

io.r2dbc:r2dbc-spi:0.8.6.RELEASE (selected by rule)
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.gradle.jvm.environment         = standard-jvm
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 17
   ]

io.r2dbc:r2dbc-spi:0.9.0.RELEASE -> 0.8.6.RELEASE
+--- project :proj-data
|    \--- runtimeClasspath
\--- org.postgresql:r2dbc-postgresql:0.9.0.RELEASE
     \--- project :proj-data (*)

(*) - dependencies omitted (listed previously)

It's clear that 0.8.6.RELEASE is picked up, but what I don't understand is why? Or where does it come from? I thought the following snippet:

io.r2dbc:r2dbc-spi:0.9.0.RELEASE -> 0.8.6.RELEASE
+--- project :proj-data
|    \--- runtimeClasspath
\--- org.postgresql:r2dbc-postgresql:0.9.0.RELEASE
     \--- project :proj-data (*)

Indicated which versions of the dependency are available (in this case, as transitive dependencies). However, 0.8.6.RELEASE does not appear anywhere to the left of the arrow, so doesn't this mean that it's not provided by any dependency?

UPDATE Decided to try and force it with no result, I added this snippet to the parent project's build.gradle:

subprojects {
    configurations.all {
        resolutionStrategy {
            force("io.r2dbc:r2dbc-spi:0.9.0.RELEASE")
        }
    }
}

The result is almost exactly the same, only that dependencyInsight seems to think 0.8.6.RELEASE was chosen by force:

io.r2dbc:r2dbc-spi:0.8.6.RELEASE
   variant "runtime" [
      org.gradle.status                  = release (not requested)
      org.gradle.usage                   = java-runtime
      org.gradle.libraryelements         = jar
      org.gradle.category                = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling     = external
         org.gradle.jvm.environment         = standard-jvm
         org.jetbrains.kotlin.platform.type = jvm
         org.gradle.jvm.version             = 17
   ]
   Selection reasons:
      - Forced
      - Selected by rule

io.r2dbc:r2dbc-spi:0.9.0.RELEASE -> 0.8.6.RELEASE
+--- project :proj-data
|    \--- runtimeClasspath
\--- org.postgresql:r2dbc-postgresql:0.9.0.RELEASE
     \--- project :proj-data (*)

(*) - dependencies omitted (listed previously)
Haf
  • 375
  • 1
  • 3
  • 13
  • Can you share what your `dependencies` block looks like? – romtsn Feb 16 '22 at 22:04
  • Sorry, I already found out this question is a duplicate of [this one](https://stackoverflow.com/questions/37153484/why-does-gradle-downgrade-my-transitive-dependencies-in-a-grails-3-1-application) and flagged it – Haf Feb 17 '22 at 08:43

0 Answers0