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

mat*_*szb 2 java rest archiva

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

现在我可以通过使用工件下载URL的直接URL来实现,这似乎不是一个好方法.

我错过了什么休息服务,这将允许我做以下服务器:port/restServices/getArtifact/groupId/artifactId/version

Dan*_*Dan 7

REST调用是:

GET http://server/restServices/archivaServices/browseService/artifactDownloadInfos/{group}/{artifact}/{version}
Run Code Online (Sandbox Code Playgroud)

响应包含一个条目列表,其"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
   }
]
Run Code Online (Sandbox Code Playgroud)

请享用!