Originally posted by Peter Johnson:
The only way I know of is to delete the repository and let Maven rebuild it.
That's a good point and probably the only feasible way to do 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).
Maybe, the other way this could have been handled by Maven was to "clean-first-download-next" type of approach. Something like:
- pom.xml has a dependency on artifact "xyz" of version 1.2.4
- Since the download location is standard, Maven could have allowed an configuration to decide whether the download location for "xyz" (within the repository) should be first cleared (of earlier downloads)
- Next download the version 1.2.4
Haven't given much thought as to what issues this might cause.
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.
Yes, i remember waiting for around an hour for my first build of this project
Most of the time was spent in downloading the jars.
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.
At this point, i think we are OK with deleting and recreating the entire repository.
[ August 22, 2008: Message edited by: Jaikiran Pai ]