我在 Nexus 3.x 中创建了一个原始存储库,我可以将工件上传到相同的。现在我想使用 Rest API 获取驻留在该 repo 中的所有工件的列表。
任何帮助表示赞赏。
最佳答案
在当前的 Nexus3.14.0-04 中,REST API 已成为最终版本(不再是“测试版”),您需要的 curl 是:
curl -X GET "http://localhost:8081/service/rest/v1/components?repository=central "-H "accept: application/json"
这将返回每个“组件”(组、名称、版本)及其所有 Assets = 构成组件的每个单独文件(pom、sha1、md5、jar)
结果是一个 JSON 字符串。
相反,如果您想执行 COMPONENTS 搜索 - 基于 groupId、artifactId - 您可以使用此 curl:
curl -X GET "http://localhost:8081/service/rest/v1/search?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension=jar "-H "accept: application/json"
这将返回带有子 Assets 的组件。
只检索 ASSETS 而不按 COMPONENT 对它们进行分组的变体是 GET/service/rest/v1/search/assets?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension = jar
关于用于从 Nexus OSS 3.x 存储库获取工件列表的 Rest API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43843273/