0
$ ./gradlew -v
------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------

I have the following build.gradle file for Project1

dependencies {
  implementation "com.company.common:common-dep:2.0.0"
  implementation "com.company.other:my-other-project:2.0.0"
}

I expect it to download common-dep:2.0.0 artifact.

Now, here’s the build.gradle for my-other-project:2.0.0

dependencies {
  implementation "com.company.common:common-dep:1.0.0"
}

As you can see, it’s dependent on common-dep:1.0.0, NOT common-dep:2.0.0

Now when I run dependency on the first project I get

./gradlew dependencies
+ com.company.common-dep:2.0.0 -> 1.0.0

That is, it uses the the lower version of the artifact, the one that it’s other dependency needs. I’m guessing this is the expected (and correct) behavior?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.