组内的Nexus REST API查询工件 [英] Nexus REST API query artifacts within a group
问题描述
我有一个Nexus Maven存储库,我想利用REST API查询特定组中的工件列表.我偶然发现了此文档,但看起来非常简洁,找不到所需的文件.
I have a Nexus maven repo and I would like to leverage REST API to query the list of artifacts lying in my specific group. I stumbled upon this documentation but it seems to be very concise and I cannot find there what I need.
https://oss.sonatype.org/nexus-restlet1x-plugin/default /docs/rest.html
我想要这样的东西
http://mydomain:8081/nexus/service/local/repositories/list?groupId=com.test.superproduct&repo=snapshots
它会向我输出一个列表
- product-1.0.0-SNAPSHOT
- product-1.0.1-SNAPSHOT
- 产品1.0.2-快照 .....
- product-1.0.0-SNAPSHOT
- product-1.0.1-SNAPSHOT
- product-1.0.2-SNAPSHOT .....
更具体地说,我需要一个列表中的工件版本列表,但是我也可以从工件名称中提取版本.
To be more specific I need a list of versions of artifacts lying in a group, but I can extract versions from artifact names too.
推荐答案
结果是,我需要做的就是获取ˇmaven-metadata.xml`文件,该文件包含可用于此工件的所有版本.例如
It came out that everything I needed is to fetch ˇmaven-metadata.xml` file that comprises all versions available for this artifact. For example,
https://oss.sonatype.org/service/local/repositories/snapshots/content/com/alibaba/rocketmq/rocketmq-all/maven-metadata.xml
包含
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>com.alibaba.rocketmq</groupId>
<artifactId>rocketmq-all</artifactId>
<versioning>
<latest>3.1.8-SNAPSHOT</latest>
<release></release>
<versions>
<version>3.0.2-open-SNAPSHOT</version>
<version>3.0.10-ALIYUN-SNAPSHOT</version>
<version>3.0.11-SNAPSHOT</version>
<version>3.1.8-SNAPSHOT</version>
</versions>
<lastUpdated>20140807060304</lastUpdated>
</versioning>
</metadata>
这篇关于组内的Nexus REST API查询工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!