gpt4 book ai didi

java - 如何使用 REST 以编程方式从 apache archiva 下载单个工件?

转载 作者:行者123 更新时间:2023-12-05 09:23:45 27 4
gpt4 key购买 nike

我浏览了文档并发现了很多有用的东西。我目前正在使用 apache archiva 作为镜像。使用 maven 下载工件工作正常,但出于某些原因我希望能够使用 REST api 下载工件。

目前,我可以通过直接使用工件下载 URL 的 URL 来完成此操作,这似乎不是一个好方法。

是否有任何我错过的休息服务可以让我执行以下服务器:port/restServices/getArtifact/groupId/artifactId/version

最佳答案

REST 调用是:

GET http://server/restServices/archivaServices/browseService/artifactDownloadInfos/{group}/{artifact}/{version}

响应包含一个条目列表,其“url”键是下载工件的链接。每个可下载资源都有一个条目,例如一个用于 jar,另一个用于 pom 等。'type' 键可用于区分哪个。

示例响应:

[
{
"context": "internal",
"url": "http://server/repository/internal/group/artifact/version/artifact-version.jar",
"groupId": "group",
"artifactId": "obs.interfaces",
"repositoryId": "internal",
"version": "version",
"prefix": null,
"goals": null,
"bundleVersion": null,
"bundleSymbolicName": null,
"bundleExportPackage": null,
"bundleExportService": null,
"bundleDescription": null,
"bundleName": null,
"bundleLicense": null,
"bundleDocUrl": null,
"bundleImportPackage": null,
"bundleRequireBundle": null,
"classifier": null,
"packaging": "jar",
"fileExtension": "jar",
"size": "31.78 K",
"type": "jar",
"path": "group/artifact/version/artifact-version.jar",
"id": "artifact-version.jar",
"scope": null
},
{
"context": "internal",
"url": "http://server/repository/internal/group/artifact/version/artifact-version.pom",
"groupId": "group",
"artifactId": "artifact",
"repositoryId": "internal",
"version": "version",
"prefix": null,
"goals": null,
"bundleVersion": null,
"bundleSymbolicName": null,
"bundleExportPackage": null,
"bundleExportService": null,
"bundleDescription": null,
"bundleName": null,
"bundleLicense": null,
"bundleDocUrl": null,
"bundleImportPackage": null,
"bundleRequireBundle": null,
"classifier": null,
"packaging": "pom",
"fileExtension": "pom",
"size": "1.58 K",
"type": "pom",
"path": "group/artifact/version/artifact-version.pom",
"id": "artifact-version.pom",
"scope": null
}
]

尽情享受吧!

关于java - 如何使用 REST 以编程方式从 apache archiva 下载单个工件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19318028/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com