Reputation: 3
I have below structure for the project.
project
|_build.properties
|_plugins.sbt
Core
Module1
Module2
build.sbt
In Module1 and Module2, I use the same dependency in different versions. Then I aggregate the 2 modules with Core module. Then one dependency is getting evicted by another version. How do I keep both dependency versions?
Update: The expected dependency tree is as follows:
core_1.0-SNAPSHOT
-module1_1.0
--org.milyn:milyn-smooks-core:1.1
-module2_1.0
--org.milyn:milyn-smooks-core:1.5.2
module1_1.0-SNAPSHOT
-org.milyn:milyn-smooks-core:1.1
module2_1.0-SNAPSHOT
-org.milyn:milyn-smooks-core:1.5.2
And, what I getting is as follows:
core_1.0-SNAPSHOT
-module1_1.0
--org.milyn:milyn-smooks-core:1.1 (evicted by 1.5.2)
-module2_1.0
--org.milyn:milyn-smooks-core:1.5.2
module1_1.0-SNAPSHOT
-org.milyn:milyn-smooks-core:1.1
module2_1.0-SNAPSHOT
-org.milyn:milyn-smooks-core:1.5.2
How can I disregard the eviction?
Upvotes: 0
Views: 172
Reputation: 15105
In 99% of cases you don't want to have two versions of the same dependency. Assuming they contain same classes (as in the same name), it will cause runtime errors as only one version will be loaded (first come, first loaded).
What you likely want to do is:
dependencyOverrides
in your "Core" module to force a version (which can be the one of "Module1", "Module2", or even another one)Upvotes: 1