Download all dependencies


(gradle) #1

Looking for a way to force gradle to download all dependencies, including those of subprojects. The answer reported by Peter here http://gradle.1045684.n5.nabble.com/Fast-way-to-download-all-external-dependencies-td4423622.html 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?

Thanks

Tom


(gradle) #2

Supplementary question: the dependencies task itself doesn’t seem to force a download of relevant jars, either, just the poms. See e.g. https://travis-ci.org/tomdcc/miniprofiler-jvm/builds/24597258 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?

Thanks

Tom


(gradle) #3

Bump…


(Peter Niederwieser) #4

You can do something like this:

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

Then ‘gradle resolveAllDependencies’ will do the job.


(gradle) #5

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

Thanks for that Peter, exactly what I was after.

Cheers