Thank you for the syntactic match on a search engine.
The first one is interesting, but if it works automatically, then my caches should be already cleaned up by the daemon (in addition to the cleaning I perform to prevent the cache from being repackaged at every run). I may force a
before_cache and see if it improves - maybe the deamon doesn’t get shut down correctly automatically.
Unfortunately, the latter two links you posted are on entirely another topic. Pruning unused dependencies in a single project does not mean cleaning up the dependency cache from the home folder of a system. It is entirely different (and dependencies are regularly maintained).
Let me explain: every Gradle run caches the downloaded jars (and other stuff that I delete already) in the home folder.
If I use dependency X 1.0, it gets cached.
If I upgrade to X 2.0, it get cached as well, but X 1.0 does not get deleted as Gradle has no mean to know it is not used by another project, or still by the same project in a different lifecycle phase – but to wait and see if it has never got accessed for a long time (which looks like being the strategy of the first link).
A proactive search of unused cached libraries (not dependencies to prune) would require a new tool, AFAIK.