Gradle cache growing indefinitely

Hi all,

Is there ANY mechanism in gradle cache to delete old snapshot artifacts? Caches on our build servers seem to be growin indefinitely and can take up to several GBs. We continuously build with new snapshot artifacts several times per day and gradle cache seems to be collecting ALL those artifacts. Is there a way to tell Gradle cache to delete all SNAPSHOT artifacts but last one (or few last ones …)? Thanks.


That’s certainly an aspect of the Gradle cache we’d like to optimize. It would make sense to delete caches of older (and potentially unused) Gradle versions after a while. The same is true for outdated SNAPSHOT versions. At the moment there’s no way to tell Gradle to delete old dependency artifacts from the cache.

It would certainly be great if we could have the functionality in Gradle core. If you are interested in contributing, a good place to start would a discussion on the Gradle dev list.