【发布时间】:2022-02-15 21:59:34
【问题描述】:
我正在尝试使用 curl 从 Nexus Pro 3.37.3-02 下载工件,但它无法正常工作。我发现以下命令适用于许多其他命令,但在我的情况下,我正在获取存储库、maven.groupId、maven.artifactId、maven.baseVersion、maven.extension 未被识别为内部或外部命令、可运行程序或批处理文件.
curl -u 用户名:密码 -L -X GET https://MY_NEXUS/service/rest/v1/search/assets/download?sort=version&repository=MY-REPO&maven.groupId=MY_GROUP&maven.artifactId=MY_ARTIFACT_NAME&maven.baseVersion= 0.1-SNAPSHOT&maven.extension=zip
我已按照此文档执行此命令。 https://help.sonatype.com/repomanager3/integrations/rest-and-integration-api/search-api
任何帮助将不胜感激。 谢谢,
【问题讨论】:
-
您是否收到错误消息? curl 告诉你什么?状态码?给定的存储库是快照存储库吗?
-
是的,它是一个快照存储库,这是我收到的错误 {"errors":[{"code":"UNAUTHORIZED", "message":"access to the requested resource is not authorized" , " detail":null}]} 我的凭据是正确的,我可以使用相同的凭据从 nexus 界面下载工件。
-
我也尝试使用令牌用户名和密码,而不是普通的用户名和密码,但低于。 { "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", "manifest": [ { "mediaType": "application/vnd.docker.distribution.manifest. list.v2+json" "size": 1155, "digest": "jkgj" "platform": { "architecture": "amd64" "os": "linux" } } ] } maven.groupId 也有同样的警告, maven.artifactId、maven.baseVersion 和 maven.extension。
-
首先你应该尝试解决这个问题:
UNAUTHORIZED... -
感谢您的帮助,问题已通过使用令牌和令牌密码而不是普通用户名/密码并在 URL 周围添加双引号来解决,如下所示。