如何配置Maven或Apache Archiva,它只保留快照的N个版本

时间:2012-09-07 09:33:11

标签: maven archiva

我们的Archiva Repository永远不会删除旧的快照。 这会产生大量垃圾。

是否有可能告诉Archiva只保留快照的N版?

最诚挚的问候, 基督教。

3 个答案:

答案 0 :(得分:3)

请浏览http://archiva.apache.org/docs/2.2.0/adminguide/repositories.html

您将找到以下

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. 

答案 1 :(得分:3)

别忘了去:

Repository Scanning -> Consumers

并确保repository-purge已启用

答案 2 :(得分:1)

我知道它已经得到了解答,但最近我遇到了同样的问题而且还要多做一步:回购路径指向一个错误的目录,尽管配置正确,清理快照仍无法正常工作。

要更正路径,请转到:

存储库管理 - >托管存储库管理 - >编辑“Archiva托管快照存储库” - >将“目录”参数设置为正确的值(对我而言,它是“/var/lib/apache-archiva-2.2.0/repositories/snapshots”)。

执行此操作时,快照清理开始起作用。

[编辑 - 2017-11-02]

另外,我想知道为什么在清理主要工件时没有清除一些附加的工件(例如html文件)。我刚想通了:如果它不是Archiva的工件类型,你必须指定扩展名。 例如,在我的情况下,在存储库扫描中 - >文件类型 - >工件 - >我不得不为附加的html文件添加'** / * .html'以开始清理。

希望这可能会有所帮助