Download all dependencies

Looking for a way to force gradle to download all dependencies, including those of subprojects. The answer reported by Peter here doesn’t seem to work, I just get:

No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.dependsOn() is applicable for argument types: (java.util.ArrayList) values: [[org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler@47bd2241, …]]

I guess because “dependencies” will trigger the dependencies DSL. However, trying to look up the dependencies task by name (ie tasks[‘dependencies’] also fails, for both the root project and subprojects:

Task with name ‘dependencies’ not found in root project ‘myproject’.

Task with path ‘:subproject-name:dependencies’ not found in root project ‘myproject’

Maybe the depencencies task only gets added later on? I dunno.

Anyway, any tips on how to get Gradle to download all the subproject dependencies without listing them all on the command line?



Supplementary question: the dependencies task itself doesn’t seem to force a download of relevant jars, either, just the poms. See e.g. where despite calling the dependencies task in the install phase, the main build phase is littered with downloads.

Is there any way to force download of the jars too?




You can do something like this:

allprojects {
    task resolveAllDependencies {
        doLast {
            configurations.all { it.resolve() }

Then ‘gradle resolveAllDependencies’ will do the job.

Ah, I didn’t know about the resolve() method.

Thanks for that Peter, exactly what I was after.