Purge snapshots from local gradle cache


I have not seen a way to do this but I think I’m just missing something basic.

  1. Project A builds a SNAPSHOT artifact, a zip file, which is ~ 1.0 GB in size. This zip is then published to repository server.
  2. Project B has a dependency on the SNAPSHOT built from Project A. Gradle downloads the snapshot from repository server, then does stuff with it. Cache changing modules is set to “0” seconds so the newest daily SNAPSHOT is always fetched.

Project A and Project B run daily.

The <USER_HOME>/.gradle directory is growing exponentially daily because of the Project A SNAPSHOT download. Eventually we run out of disk space.

Is there a way to “purge” all SNAPSHOTS from the <USER_HOME>/.gradle directory with Gradle itself? Right now I will have to write some kind of shell script with hardcoded paths to do the cleanup.