bysiber commented on issue #9076:
URL: https://github.com/apache/maven/issues/9076#issuecomment-4001664124

   +1 for incremental `.m2` cache cleanup on CI. Maven's local repository grows 
indefinitely on long-running CI runners, and there's no built-in way to expire 
artifacts that aren't needed anymore.
   
   Quick audit:
   
   ```bash
   du -sh ~/.m2/repository/ 2>/dev/null
   du -sh ~/.m2/repository/*/ 2>/dev/null | sort -hr | head -20
   
   # Find artifacts not accessed in 90+ days
   find ~/.m2/repository -name "*.jar" -atime +90 2>/dev/null | wc -l
   ```
   
   Workaround for CI runners until a proper solution lands:
   
   ```bash
   # Remove SNAPSHOT artifacts older than 30 days
   find ~/.m2/repository -path "*-SNAPSHOT*" -mtime +30 -exec rm -rf {} + 
2>/dev/null
   
   # Remove download/transfer metadata
   find ~/.m2/repository -name "_remote.repositories" -delete 2>/dev/null
   find ~/.m2/repository -name "*.lastUpdated" -delete 2>/dev/null
   
   # Remove specific old versions (keep only latest)
   # Requires manual identification per artifact
   ```
   
   On CI runners, Maven's `.m2` is often the largest single cache directory, 
easily 5-20GB. Combined with Gradle caches, build outputs, and Docker layers, 
self-hosted runners can fill up fast.
   
   For local macOS development machines, the picture is even broader — `.m2` 
plus Xcode DerivedData, Homebrew, node_modules, Docker, pip, Cargo, and 40+ 
other developer caches can add up to 50-100GB+. 
[ClearDisk](https://github.com/bysiber/cleardisk) is a free, open-source macOS 
menu bar utility that monitors all of these paths in real-time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to