Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Originally posted by Peter Johnson:
The only way I know of is to delete the repository and let Maven rebuild it.
Originally posted by Peter Johnson:
The problem with having an automated mechanism to do this is that a pom.xml can specify a dependency on a particular version of an artifact. For example, if you have 4 versions of a particular artifact, the only way you could tell if any of those versions were no longer needed is to look at every pom.xml on your system (this would be a transitive lookup starting from your projects' pom.xml file and going through every pom.xml for every dependency).
Originally posted by Tim Holloway:
So as long as it's not the primary source for a module, you can usually safely mass-delete its contents. Though the inrush to replace the deleted modules for the first few builds is likely to be ferocious.
Originally posted by Tim Holloway:
If you want something less extreme, you could simply delete all modules which haven't been referenced within a given period of time. Most corporations should make that at least 13 months, since some programs are only used at the end of the physical or fiscal years.
Originally posted by John Chambers-Malewig:
Just as a thought, you might want to look at the dependency plugin. The purge-local-repository goal might be what you are looking for.
http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html