Gradle dependencies not applied to subprojects

I believe that if I run

gradle foo

, this should run the task foo in all subprojects.

Now the command:

gradle dependencies

sadly behaves against that general pattern, i.e. it only executs inthe root project.

In my case case I have a root project without any java sources, and multiple subprojects with java sources, and I would like to get the dependencies of each of those. I copied snippets from the gradle project itself:

configurations {
    runtime {
        visible = false
    }
    testRuntime {
        extendsFrom runtime
    }
}
  dependencies {
    runtime project(':foo')
    runtime project(':bar')
}

But this still does not give me the test dependencies, e.g. junit (same for the gradle project itself). I can call

gradle :foo:dependencies :bar:dependencies

but this is cumbersome.

Is there some other not too hacky trick to get a nice overview?

dependencies, help, projects, tasks and a few others are implicit tasks tied to their project and the rule from http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:execution_rules_for_multi_project_builds does not apply. You are right that the documentation should be more precise about that. Unless there is a contribution it is likely that the fix will wait until we start doing change to make these tasks visible in Tooling API.

In the meantime, couldn’t he write a task that just iterates through the subprojects and their dependencies and does the same thing? In that vein, could you iterate through the subprojects and run the “dependencies” task on each one?

What I need as a workaround is merely a way to declare testRuntime dependencies of certain subProjects as testRuntime dependencies of the root project.