How to configure Maven or Apache Archiva that it keeps only N builds of an snapshot

巧了我就是萌 提交于 2019-12-05 08:29:57
Prasad S Deshpande

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. 
user3774109

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!