Inconsistent handling of runtime dependencies of compile dependencies (Gradle build vs IDEA plugin)

Let say, I have project A with configuration like this:

apply plugin: 'java'
apply plugin: 'idea'
dependencies {
    runtime name: 'somelib'
}

And a project B:

apply plugin: 'java'
apply plugin: 'idea'
dependencies {
    compile project(':A')
}

In project B there is a class that imports and uses some class from somelib.

When I build the whole project using ‘gradle build’, it compiles (so, I understand that somelib was included in the compile process, because A is a compile dependency of B).

When I generate the IDEA config (using the Gradle’s idea plugin) and build it using IDEA, it doesn’t compile (so, I understand that IDEA treats the somelib dependency as runtime-only dependency and doesn’t include it in the compilation).

I don’t know which one of those 2 behaviours is the correct one, but for sure they should be consistent.

IntelliJ uses Maven’s way of computing transitive dependency scopes, which is why you see a difference. Our goal is that at some point, IDEs will delegate all build related activities to Gradle (like Android Studio already does today), which will give completely same behavior in IDE, command line build, and CI build.