Transitive dependencies on files(...) are included even if configuration's 'transitive' property is explicitly set to 'false'

Imagine you have a project with two subprojects.

root:

apply plugin: 'java'
repositories { mavenCentral() }
task libs(type: Sync) {
    from configurations.detachedConfiguration(dependencies.project(path: ':b', configuration: 'compile'))
    into 'libs'
}

a:

apply plugin: 'java'
dependencies {
    compile files('build.gradle')
}

b:

apply plugin: 'java'
configurations { compile { transitive = false } }
dependencies {
    compile project(':a')
}

If you execute ‘gradle libs’, you’ll get two jar-files in the libs folder: a.jar, and build.gradle Since project ‘b’ has transitive flag set to false for compile configuration, I would expect the resulting folder to include only a.jar.

If you replace ‘from’ argument by this implementation, you’ll get a single jar-file (a.jar) in the libs folder.

from project(':b').configurations.compile

Current behavior of detached configuration looks like a bug. is this a bug indeed?

I could use the workaround that I have mentioned, but it also requires direct call of ‘project(’:b’).evaluate()’, otherwise it’s compile configuration might be empty.

Gradle versions tested: 1.12, 2.1.