Our Archiva Repository never deletes old Snapshots. That generates a lot of garbage.
Is it possible to tell Archiva to keep only N builds of an Snapshot?
Best Regards, Christian.
Please go through http://archiva.apache.org/docs/2.2.0/adminguide/repositories.html
You will find following
repository purge by days older - the first option for repository purge. Archiva will check how old the artifact is and if it is older than the set number of days in this field, then the artifact will be deleted respecting the retention count (see #7) of course. In order to disable the purge by number of days old and set Archiva to purge by retention count, just set the repository purge field to 0. The maximum number of days which can be set here is 1000. See the Repository Purge section below for more details.
repository purge by retention count - the second option for repository purge. When running the repository purge, Archiva will retain only the number of artifacts set for this field for a specific snapshot version. See the Repository Purge section below for more details.
delete released snapshots - specifies whether to remove those snapshot artifacts which already has release versions of it in the repository during repository purge.
Don't forget to go to:
Repository Scanning -> Consumers
and make sure that the repository-purge
is enabled
I know it has already been answered, but I had the same question recently and had to do one step more: the path to the repo was pointing to a wrong directory and despite the correct configuration, cleaning snapshots was not working...
To correct the path, go to:
Repositories Administration --> Managed Repositories Management --> edit the "Archiva Managed Snapshot Repository " --> set the "Directory" param to the correct value (for me it's "/var/lib/apache-archiva-2.2.0/repositories/snapshots").
When doing this, snapshot cleaning started to work.
[edit - 2017-11-02]
Additionnaly, I was wondering why some attached artifacts (such as html files) were not being cleaned when the main artifacts were cleaned. I've just figured it out: you have to specify the extension if it is not known as an artifact type from Archiva. For example in my case, in Repository Scanning --> File types --> artifacts --> I had to add '**/*.html' for the attached html files to start being cleaned.
Hope this may help
来源:https://stackoverflow.com/questions/12315461/how-to-configure-maven-or-apache-archiva-that-it-keeps-only-n-builds-of-an-snaps