Monday, July 19, 2010

Quick and dirty remove -SNAPSHOTS from your local maven repository

Works on *nix

find ~/.m2/repository -type d -name \*-SNAPSHOT -exec rm -rvf {} \;

By searching for the directories we should catch the -YYYYMMDD.HHMMSS format of snapshots also

2 comments:

  1. Yes, this works indeed, but the maven-metadata files will get corrupted. Sounds like one of the maven-plugins should be extended with a new feature to keep it clean ;)

    ReplyDelete
  2. @rfscholte
    I did say it was quick and dirty ;-) I agree that the local repository needs a plugin to help keep it clean... hopefully with the aether abstractions coming in 3.0 (which afaik could still be a dependency of a plugin running in 2.x) it would be easier to keep control of

    ReplyDelete