How to understand the following task? Gradle docs tell that Copy used for copying.
Some tutorial tells that the calling the below task causes gradle to download, copy all application and test dependencies while not actually saving them to /tmp. I don’t understand it and what are configurations.runtime + configurations.testRuntime
task copyDeps(type: Copy) {
from (configurations.runtime + configurations.testRuntime) exclude '*'
into '/tmp'
}
By specifying the configuration in the from, it causes the configurations to be resolved and downloaded (but not truly copied anywhere other than what happens when resolved).
If a task is desired to just resolve the dependencies, I would write one to do exactly that, not what the tutorial has done. This would do the same thing, but should be more intention-revealing:
Thanks a lot!
This task was inside Dockerfile. According to the video course, the intent was to cache the dependencies in Docker layers cache, without exploding the /tmp folder.