When you add a dependency on a project like this:
testCompile project(':B')
you're depending on the default artifact produced by project B, which is usually the default jar. If you want to depend on a custom jar, something like a test jar, or a resource jar, or a fat jar instead, you have to explicitly specify that. You can add custom artifacts to configurations, and depend on the configuration instead, as shown below:
in B's build.gradle:
configurations {
foo
}
task testJar(type: Jar) {
classifier 'resources'
from sourceSets.main.resources
}
artifacts {
foo testJar
}
and then use it in A as:
dependencies{
testCompile project(path: ':B', configuration: 'foo')
}
To verify, you can add this task to A:
task printClasspath()<<{
configurations.testCompile.each{println it}
}
which prints:
${projectRoot}\B\build\libs\B-resources.jar