如何使用Artifactory Query Language查找最新的工件版本? [英] How to find the latest artifact version with Artifactory Query Language?

查看:114
本文介绍了如何使用Artifactory Query Language查找最新的工件版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到现在,我仍使用Artifactory REST API来确定具有groupIdartifactIid的Maven工件的最新版本(最新快照):

Until now, I used the Artifactory REST API to determine the last version (last snapshot) of a maven artifact with groupId and artifactIid:

/api/search/latestVersion?g={groupid}&a={artifactid}

这给了我一个确切的字符串,该字符串具有此工件的最高/最后可用(快照)版本.

This gives me exactly a string with the highest/last available (snapshot) version of this artifact.

但是,有时这确实很慢,因此建议使用Artifactory Query Language(AQL).

However, this is sometimes really slow and one recommendation was to use the Artifactory Query Language (AQL).

不幸的是,我还无法找出如何在AQL中映射此功能.

Unfortunately I have not yet been able to find out how to map this functionality in AQL.

有人可以给我一个有关AQL中相应查询的外观的线索吗?

Could someone give me a clue as to what a corresponding query in AQL could look like?

提前谢谢!

推荐答案

您可以使用AQL的SORT和LIMIT来检索最新的工件,例如:

You can use AQL's SORT and LIMIT to retrieve your latest artifact, for example:

items.find(
{
            "repo":"my-repo"
    }
).sort({"$desc" : ["created"]}).limit(1)

您可以在此处找到更多示例

我还建议您试用 Jfrog CLI ,它也支持排序,并且可能更易于使用.

I would also recommend trying out the Jfrog CLI, which also supports Sorting, and might be easier to use.

这篇关于如何使用Artifactory Query Language查找最新的工件版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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