How do I depend on a project and its resolved dependencies?

Say I have two subprojects, ‘a’ and ‘b’.

In a/build.gradle I setup a dependency where I force it to use a different version of a transitive dependency:

dependencies {

‘org.eclipse.jetty:jetty-annotations:9.2.3.v20140905’

}

configurations.all {

resolutionStrategy {

eachDependency { DependencyResolveDetails details ->

if (details.requested.group == ‘org.ow2.asm’) {

details.useTarget ‘asm:asm-all:3.3.1’

}

}

}

}

in b/build.gradle I use a:

dependencies {

compile project(’:a’)

}

What I expect happens is that b will use the ‘asm:asm-all:3.3.1’ I forced A to use. But it doesn’t, it drags in the normal transitive dependency.

So my question. How do I depend on the project and its resolved dependency?

Can you put the first block inside of an ‘allprojects { }’ closure within your top ‘build.gradle’ file?