使用运行的计划任务删除快照但不删除工件 [英] Remove snapshots using scheduled task running but not removing artifacts

查看:73
本文介绍了使用运行的计划任务删除快照但不删除工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 nexus 服务器版本 2.11.1-01,它有一个计划任务设置来运行我们的快照存储库,以删除最小快照计数设置为 3 和保留 5 天的快照.计划任务显示它正在运行,但是当我查看我们的存储库时,对于一个跨越 6 个月的工件 gav,有多达 26 个快照.

I have a nexus server version 2.11.1-01 that has a scheduled task setup to run over our snapshots repo to remove snapshots with the minimum snapshot count set to 3 and a retention of 5 days. The scheduled task is showing that it runs, but when I look through our repository there are as many as 26 snapshots for one artifact gav spanning 6 months.

是否有什么配置不正确或有什么方法可以找出它运行不正确的原因?

Is there something not configured correctly or a way to find out why it isn't running correctly?

推荐答案

this nexus Jira 中所述:

快照删除器删除一个版本中带时间戳的快照文件夹.它不会删除以前版本的快照.注意有多个活动版本是很常见的给定工件的快照,有些是由分支构建生成的和其他人通过主干构建.

The snapshot remover removes timestamped snapshots within one version folder. It does not remove previous versions of snapshots. Note that it is very common for there to be multiple active versions of snapshots for a given artifact, some being produced by branch builds and others by trunk builds.

remove if release"选项可用于清理所有快照来自特定版本.

The "remove if released" option can be used to clean up all snapshots from a particular version.

此外,如其他 Jira 中所述,您必须检查文件命名布局:

Also, as reported in this other Jira, you have to check file naming layout:

Nexus 仅支持 Maven2/3 布局

Nexus supports Maven2/3 layout only



如果您想删除工件的多个版本,如此处所述,您必须使用REST API:



If you want to delete multiple versions of an artifact, as reported here, you have to use REST apis:

curl -X 删除 -u admin:admin123http://localhost:8081/nexus/service/local/repositories/releases/content/com/test/project/1.0/

curl -X DELETE -u admin:admin123 http://localhost:8081/nexus/service/local/repositories/releases/content/com/test/project/1.0/

或者,您也可以直接从存储库的磁盘上的本地存储.如果直接从本地存储中删除,则使用 REST 命令为受影响的路径重建元数据:

Or, alternatively you can delete them directly from the repository's local storage on disk. If you delete directly from local storage then use the REST command to rebuild metadata for the affected path:

curl -X 删除 -u admin:admin123http://localhost:8081/nexus/服务/本地/元数据/存储库/快照/内容/com/test/project/

curl -X DELETE -u admin:admin123 http://localhost:8081/nexus/service/local/metadata/repositories/snapshots/content/com/test/project/

您还需要更新搜索索引.如果您安排一个每晚更新索引"任务它将获取所做的任何更改直接送到存储区.

You'll also need to update the search indexes. If you schedule a nightly "update indexes" task it will pick up any changes made directly to the storage area.

这篇关于使用运行的计划任务删除快照但不删除工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆