Hello,
I am looking at a way to force all modules in the same group to use the same version, and the last one. My point is I want to be free to break internal compatibility between modules within the same groupwithin the same group, so anytime two modules of the same group are in a dependency set, they have to have the same version.
It is a bit complicated so I will take an example.
I have group1:g1module1
, group1:g1module2
, … group1:moduleN
.
g1module2
depends on g1module1
at the same version.
I also have group2:g2module1
that depends on group1:g1module1
.
Now let’s suppose that in a new module, I depends on both:
-
group1:g1module2:2.0
that depends ongroup1:g1module1:2.0
-
group2:g2module1:1.0
that depends ongroup1:g1module1:2.5
According to default resolution strategy, I will have as dependencies:
group1:g1module2:2.0 (*)
group1:g1module1:2.5 (*)
group2:g2module1:1.0
And here is my problem. I need to have all modules from group1
to be at version 2.5.
So here the solution would be:
dependencies {
compile.resolutionStrategy {
force 'group1:g1module2:2.5'
}
}
But, as I have dozen of groups with dozens of modules within, I would like a way to do this automatically, for example by implementing my own strategy.
Is there any way to achieve this ?