Nexus 3:如何获取最新快照? [英] Nexus 3 : how to get latest snapshot?

查看:325
本文介绍了Nexus 3:如何获取最新快照?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,Nexus 3还没有REST API,这对我来说很奇怪.我只能使用wget或curl手动下载工件.但是当我使用Maven 3时,所有快照工件都使用这样的时间戳命名:

As we all know Nexus 3 does not have REST API yet, which is very weird for me. I can only download artifacts manually using wget or curl. But as I'm using Maven 3, all the snapshots artifacts are named using timestamps like this :

myartifact-1.0-20161215.141522-4.tar.gz

所以我想知道如何从存储库中获取最新快照?我想使工件的下载过程自动化,但是随着名称的更改,我找不到实现此目的的任何方法.

So I want to know how I can get latest snapshots from a repo? I want to automate the download process of artifacts but as names change I didn't find any way to achieve this.

谢谢.

推荐答案

如果在存储库中仅保留一个SNAPSHOT是有效选项

此API调用将起作用:${nexusUrl}/service/rest/beta/search/assets/download?maven.groupId=${groupId}&maven.artifactId=${artifactId}&maven.baseVersion=${version}

尽管最终有了一个 Nexus3 API (有关此内容的更多信息,请参见在Sonatype的博客中),该API不会还提供了获取最新SNAPSHOT版本的方法.希望将来可以改善这种情况: NEXUS-14407 正在跟踪此功能请求.

Though there is finally a Nexus3 API (see more on this in Sonatype's blog), the API does not yet provide the means to get the last SNAPSHOT version. This situation will hopefully be improved in the future: NEXUS-14407 is tracking this feature request.

但是直到那时,我都通过定义Maven - Delete SNAPSHOT任务来解决该问题:

But until then I'm workarounding the problem by defining a Maven - Delete SNAPSHOT Task:

并将其配置为每分钟运行一次,以删除除0天之前的1个快照版本以外的所有快照版本:

and configuring it to run every minute deleting all but 1 snapshot versions older than 0 days:

这篇关于Nexus 3:如何获取最新快照?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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