Composite build with diamond dependencies

(Xinchao Zhang) #1

I have 4 projects (A, B, C and D) with a “diamond” dependency graph:

D depends on B and C
C depends on A
B depends on A

These four projects are in separate repositories at the moment and I would like to define D as a composite build so that if I have all of them cloned locally, I no longer need binary dependency to build D.

The issue I am running into is that Gradle complians:

Module version ‘group:A:0.0.2-SNAPSHOT’ is not unique in composite: can be provided by [project : C : A, project : B : A]

I think it is complianing the A referenced by B is different from the A referenced by C, although B and C do depend on the same version of A.

Am I missing anything in my setup?


(Sterling Greene) #2

Which version of Gradle are you using?

Could you post the contents of D’s settings.gradle?

(Xinchao Zhang) #3

Hi Sterling,

now you have reminded me to check the settings file so I checked all of them, and I found the problem. D’s settings.gradle is actually fine, it just has two includeBuild statements. But in B and C’s settings.gradle file, there are legacy code to manually check if A presents on disk and manipulates the project dependency accordingly.

I have removed all the extra code in B and C’s settings.gradle file (they now contains just one line for rootProject) and everything works out like magic.

Thanks for your help.

The version of Gradle is 4.0.2


(Sterling Greene) #4

Great, glad to hear.