In a gradle multi project build:
root << applies: dependency{ 'org:module:version1' }
|- foo (version1) is ok here
|- bar (version1) not ok here, I need to use version 2
Is there a way to achieve this behaviour?
An alternative you can use is the strictly
keyword. In your bar
module you can write something like:
dependencies {
//Other dependencies
compile("org:module") {
version {
strictly version2
}
because("Only version2 works in this module")
}
}
Also, if you check your bar
module dependency graph with:
./gradlew -q dependencies
You'll get an output like this:
compileClasspath - Compile classpath for source set 'main'.
+--- project :
| +--- org.sample:dependency:1.0
| +--- org.sample:other-dependency:1.0
| \--- org:module:{strictly version2} -> version2