Gathering the dependency of a configuration when it's a project

If I want to copy the dependencies of a configuration, I can do it with a Copy task as below,

configurations {
    copyConfiguration
}
dependencies {
    copyConfiguration 'junit:junit:4.12'
}
task copyDeps(type: Copy) {
    into "$buildDir"
    from configurations.copyConfiguration
}

This works fine as long as the dependency is a Extenal Module Dependency. But if it’s a project dependency like below (assuming the required project exists),

dependencies {
    copyConfiguration project(path: ':SubprojectB')
}

This gives the following output and nothing is copied.

:SubProjectA:copyDeps NO-SOURCE

I am using Gradle version 3.5
Is there any way to get the output of the default configuration of SubProjectB to get copied?

Is SubprojectB using the java plugin?

Hi Chris,
It’s using android plugin ‘com.android.application’ in my case. But does that make a difference?

Thanks for replying.