简体   繁体   English

如何使用Artifactory查询语言查找最新的工件版本?

[英]How to find the latest artifact version with Artifactory Query Language?

Until now, I used the Artifactory REST API to determine the last version (last snapshot) of a maven artifact with groupId and artifactIid : 到目前为止,我使用Artifactory REST API来确定具有groupIdartifactIid的maven工件的最新版本(最后一个快照):

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

This gives me exactly a string with the highest/last available (snapshot) version of this artifact. 这给了我一个字符串,其中包含此工件的最高/最后可用(快照)版本。

However, this is sometimes really slow and one recommendation was to use the Artifactory Query Language (AQL). 但是,这有时非常慢,一个建议是使用Artifactory Query Language(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中相应查询的样子的线索吗?

Thanks in advance! 提前致谢!

You can use AQL's SORT and LIMIT to retrieve your latest artifact, for example: 您可以使用AQL的SORT和LIMIT来检索最新的工件,例如:

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

You can find more examples here . 您可以在此处找到更多示例。

I would also recommend trying out the Jfrog CLI , which also supports Sorting, and might be easier to use. 我还建议您尝试使用Jfrog CLI ,它也支持排序,并且可能更容易使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM