Use build-cache-node while running "gradle dependencies" command


I am interested in utilizing the gradle/build-cache-node Docker image to cache dependencies when running “gradle dependencies”, without needing to hard code the configuration in settings.gradle.

The documentation covers configuring the build cache node in settings.gradle, but I am hoping there is a way to enable the caching behavior for “gradle dependencies” without modifying the settings file directly.

Is it possible to pass arguments or parameters to enable the build cache node when invoking “gradle dependencies”? Or does the build cache configuration currently need to be specified in settings.gradle to work with the dependencies task?

Any guidance on using the build cache node with "gradle dependencies" without hardcoded settings would be greatly appreciated. Thank you!

Even with hard-coding settings you will have no luck.
The build cache caches results of cacheable tasks and transforms.
The dependencies task is not worth caching.
The dependency resolution eventually being necessary for the dependencies task’s action is not part of the task.

Thanks for the reply. I want to know if there a way to optimize or configure “gradle dependencies” command so it can complete successfully without needing to add more physical resources? The goal is to run “gradle dependencies” more efficiently and faster on my existing infrastructure.

The dependencies task should not need significant physical resources and I highly doubt you can somehow “optimize” it. It just prints a text report of the resolution result.