0

In a setup like this:

Project
    -ModuleA
        implementation lib:1.1
        implementation project(:ModuleB)
    -ModuleB
        api lib:1.2
    -ExternalJar1
        -lib1.3
    -ExternalJar2
        -lib1.4

How does Gradle determine what lib version to select? As per this SO answer, version 1.4 will be selected because it's the highest version and we have not specified "any specific constraints for transitive dependencies resolution". If that's correct, wouldn't ModuleA code break if it's not expecting a newer version? How can I fix that?

Do external libraries (imported jars) live in a closed sandbox - neither exposing their dependencies to project's classpath, nor using project dependencies in their classpath? Assuming version 1.3 and 1.4 are not compatible, I can't even force one version as suggested in this SO post, what option do I have to fix this setup?

BadCode
  • 259
  • 3
  • 12
  • Use `./gradlew app:dependencies` to see what the version is in the end. And yes, ModuleA will crash if lib1.4 is not downward compatible. – iForests Nov 21 '19 at 02:59
  • 1
    Do you have an actual issue or is this question purely academic? – tynn Nov 21 '19 at 08:40
  • If it's academic, you should find the answer in the docs: https://docs.gradle.org/current/userguide/dependency_resolution.html – barfuin Nov 21 '19 at 18:17

0 Answers0