Thomas Keller
09/04/2026, 11:15 AM$GRADLE_USER_HOME/.gradle/caches/<version>/transforms directory which is gathering multiple gigabytes worth of duplicated transformed libraries that get generated through my multi component build. Now I know Gradle is first about correctness and speed and secondly only cares about optimizing cache sizes and the like, but I really, really would love to have some option in Gradle to clear outdated / unused caches. Not only transforms, but in general also cache folders from older Gradle versions, old cached distributions and the like. I know I could write a script and do it myself in one go, but then Gradle daemons need to be stopped properly, no new Gradle daemons must be started (otherwise Gradle stumbles upon corrupted caches) and in general I think it's Gradle's task to deal with its caches, not only creating them, but also keeping them under control. Is anything planned in this direction / is there eventually a ticket that I could subscribe to that would deal with that?Anze Sodja
09/04/2026, 11:37 AMThomas Keller
09/04/2026, 3:40 PMScott Palmer
09/14/2026, 2:42 PMDifferent versions of Gradle will perform maintenance on only the version-specific caches associated with each version.It sounds like this leaves stale data behind forever after migrating to a newer Gradle version. Could later Gradle versions recognize when older versions haven't been used for a long time and then remove the stale cache data of unused Gradle versions?
Anze Sodja
09/17/2026, 9:45 AMcaches/<version> and wrapper for released or snapshot versions:
beforeSettings {
caches {
releasedWrappers.setRemoveUnusedEntriesAfterDays(30)
snapshotWrappers.setRemoveUnusedEntriesAfterDays(7)
}
}
I dig into it a bit and I found that it's possible cleanup is skipped for old versions if caches/<version>/fileHashes/fileHashes.lock is missing. If you find the same issue its worth reporting, it could be a bug or just some heuristic we are missing.
Also I think it's worth opening an issue to make the documentation clearer about cleaning old Gradle versions.Vampire
09/17/2026, 9:51 AM