HI, I am having the following situation: I own a...
# community-support
r
HI, I am having the following situation: I own a library with the following constraint in the dependency declaration:
Copy code
dependencies {
  constraints {
    api("net.logstash.logback:logstash-logback-encoder") {
      version {
        strictly("[7,9)")
        prefer("7.4")
      }
    }
  }
  api("net.logstash.logback:logstash-logback-encoder")
}
In my app I am then declaring:
Copy code
dependencies{
  runtimeOnly("net.logstash.logback:logstash-logback-encoder:8.0")
}
I also enabled the
failOnVersionConflict()
and my gradle version is 8.9 My expectation is, that the dependency gets resolved to 8.0 as the library restricts the version between 7 (inclusive) and 9 (exclusive), and only if no other versions are specified it should take version 7.4, Instead I get a dependency conflict:
Copy code
Dependency resolution failed because of conflict on the following module:
   - net.logstash.logback:logstash-logback-encoder between versions 8.0 and 7.4

net.logstash.logback:logstash-logback-encoder:8.0
  Variant runtime:
    | Attribute Name                     | Provided     | Requested    |
    |------------------------------------|--------------|--------------|
    | org.gradle.status                  | release      |              |
    | org.gradle.category                | library      | library      |
    | org.gradle.libraryelements         | jar          | jar          |
    | org.gradle.usage                   | java-runtime | java-runtime |
    | org.gradle.dependency.bundling     |              | external     |
    | org.gradle.jvm.environment         |              | standard-jvm |
    | org.gradle.jvm.version             |              | 21           |
    | org.jetbrains.kotlin.platform.type |              | jvm          |
   Selection reasons:
      - By constraint
      - By conflict resolution: between versions 8.0 and 7.4

net.logstash.logback:logstash-logback-encoder:8.0
\--- runtimeClasspath

net.logstash.logback:logstash-logback-encoder -> 8.0
\--- library:2024-07-29T11-44-27
     \--- runtimeClasspath (requested library:+)

net.logstash.logback:logstash-logback-encoder:{strictly [7,9); prefer 7.4} -> 8.0
\--- library:2024-07-29T11-44-27
     \--- runtimeClasspath (requested library:+)
1
v
require
means X or higher
prefer
means X or higher or lower, I don't care, but use X if not otherwise defined But you still have a conflict between 7.4 and 8.0 and configured it to fail on such a conflict. If you think this is a bug, you should open a bug report, but I guess this is intentional and the expected behavior.
r
prefer
means X or higher or lower, I don't care, but use X if not otherwise defined
but I define it otherwise, so I am very confused why this leads to a conflict. Thanks, I will open a bug ticket then 🙂
I created an issue here now