Build cache does not cache jar task


(Szczepan Faber) #1

Yo guys! We’re experimenting with build/distributed cache and Gradle 3.5. We have noticed that with Gradle 3.3, the “jar” task was cached with our distributed cache impl. With Gradle 3.5 it is no longer cached. We even tried “quickstart” java project from Gradle samples, we enabled local build cache, ran clean build few times, and we see “jar” task executed each time. In Gradle 3.3 we used distributed cache and we saw jar task cached. Is this a know limitation? (we looked on forums but did not find).

Output from building quickstart sample with local cache enabled with Gradle 3.5:

:clean
:compileJava FROM-CACHE
:processResources
:classes
:jar
:assemble
:compileTestJava FROM-CACHE
:processTestResources
:testClasses
:test FROM-CACHE
:check UP-TO-DATE
:build

(James Justinic) #2

There is a reference to the Jar task not being cacheable in the User Guide: Chapter 15. Build Cache:

Now we see that, instead of executing the :compileJava task, the outputs of the task have been loaded from the build cache. The other tasks have not been loaded from the build cache since they are not cacheable. This is due to :classes and :assemble being lifecycle tasks and :processResources and :jar being Copy-like tasks which are not cacheable since it is generally faster to execute them.

As you noted, the Jar task was previously cacheable though. The change occurred in 25053c9fdddf831b5ba16d6f1e7595684d624528.


(Szczepan Faber) #3

(blushing) sorry I did not read the docs carefully. Makes perfect sense, thank you!!!