resolutionStrategy.dependencySubstitution not being considered


(jfriedman) #1

We have a large multi-project build and would like to give developers the option of using git sparse checkout combined with gradle dependency rules to replace any projects not of current interest with previously built jars. As a POC, I setup a simple multi-project build with 3 projects that do little more than depend on each other. I slightly modified some boiler-plate code from the samples and docs, but it doesn’t seem to be being called.

There are three projects in the example: A,B,C. Settings.gradle includes any of these projects that are present on the file system. C depends on B, which has been built to create the jar in maven local and then deleted from the file system. To make the example super-simple, I even hard-coded the substitution needed - but there is no indication that the rule is ever considered, and the configuration phase fails with the complaint that

A problem occurred evaluating project ‘:C’.

Project with path ‘:B’ could not be found in project ‘:C’.

Build.gradle for the root project includes the following:
allprojects {
apply plugin: ‘java’
repositories {
jcenter()
mavenLocal()
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute project(’:B’) with module(‘RedistPOC:B:0.1-SNAPSHOT’)
}
}
}

I’ve looked through the docs and searched google and this site. Thank you in advance for any insight into the problem, and/or useful links to understand exactly what is going on under the covers.