When using includeBuild to bring in composite project, Gradle will default to using those projects to resolve dependencies that match the group:module coordinates. I have been trying to find a way to selectively disable this functionality for certain dependencies, but am not having any luck. Here are some of my attempts:
project.configurations.each {
it.resolutionStrategy.dependencySubstitution {
all { DependencySubstitution dependency ->
if (dependency.requested instanceof ModuleComponentSelector) {
def details = dependency.requested
dependency.useTarget details
}
}
}
}
configurations.all { configs ->
dependencies.all { dep ->
configs.resolutionStrategy.force "${dep.group}:${dep.name}:${dep.version}"
}
}
No matter what I do, the project dependencies always override the module dependencies. See result of ./gradlew dependencies
below. This version of project-b doesn’t exist in my artifact repository, so it should be failing to pull and failing the build - instead it just substitutes the project dependency.
mygroup:project-b:2.2.13 -> project :project-b