Shouldn't ResolutionStrategy affect depending projects transitive dependencies?

Using Gradle 2.1, assuming a multi module build with the following direct dependencies:

junit:junit <- projectB <- projectC

whereby projectB uses ResolutionStrategy.eachDependency {} to exchange junit’s transitive dependency to something else. To my surprise the dependency tree looks like this:

------------------------------------------------------------
Project :projectB
------------------------------------------------------------
compile - Compile classpath for source set 'main'.
+--- junit:junit:4.11
|
  \--- org.hamcrest:hamcrest-core:1.3 -> something:else:0.0.0 FAILED
\--- project :projectA
  ------------------------------------------------------------
Project :projectC
------------------------------------------------------------
compile - Compile classpath for source set 'main'.
\--- project :projectB
     +--- junit:junit:4.11
     |
  \--- org.hamcrest:hamcrest-core:1.3
     \--- project :projectA

Note how the transitive dependency only gets changed for projectB, but not for projectC. The only way to solve this, is by applying the same ResolutionStrategy to both projects. Besides coupling my projects, it also means that each project needs to re-evaluate each dependency. The same is true for forced versions.

Is there a way to configure ResolutionStrategy to take upstreams ResolutionStrategy into account? Producing an ‘inheritance’ of transitive dependencies from project dependencies the same way exclusions work.

As you already figured out, it’s currently necessary to set resolution rules on the configuration(s) that are actually being resolved.

Is this something that might get changed in future versions? Or should I prepare my builds to always configure ResolutionStrategy related stuff from the root project?

I already have some code that alters the generated POM files, to be in line with manipulations done by ResolutionStrategy. This means, that downstream projects, that aren’t part of the multi-project build will receive the proper set of transitive dependencies, but my project dependencies don’t, which seems weird.

I don’t know if it’s going to change. For now I’d assume it won’t.

Ok, thanks for the quick response.