Having very little experience with the build cache, here’s my guess; the compile classpath is an input to the compileJava task, so the dependencies are part of the task’s cache key and therefore need to be downloaded in order to perform the key calculation.
Thanks for your answers. My thinking was that it should not download jar files in order to calculate if dependencies changed or not, there are checksums for that.
Yes, I was referring to maven metadata, Java plugin could download only metadata instead of jar files and calculate dependencies input change based on those.