Download dependencies task

Hi

I would like to create a task that downloads all the project dependencies. And since Gradle 5.1 is out I tried to use new Gradle features: task configuration, java-library plugin. And here is the task:

tasks.register("downloadDependencies") {
   doFirst {
       project.rootProject.allprojects.each { subProject ->
           subProject.buildscript.configurations.each { configuration ->
               resolveConfiguration(configuration)
           }
           subProject.configurations.each { configuration ->
               resolveConfiguration(configuration)
           }
       }
   }
}

boolean resolveConfiguration(configuration) {
    if(configuration.isCanBeResolved()) {
        configuration.resolve()
    }
}

Some configurations can’t be directly resolved, for example, implementation. And if I have these dependencies:

implementation(platform("org.glassfish.jersey:jersey-bom:$jerseyVersion"))
testCompileOnly("org.glassfish.jersey.test-framework:jersey-test-framework-core")

jersey-bom dependency is skipped (because it uses implementation configuration) and jersey-test-framework-core is not skipped so Gradle complains that it can’t find the dependency version for it.

Please, any suggestions?