【问题标题】:Getting the Latest Release of an Artifact in Nexus在 Nexus 中获取工件的最新版本
【发布时间】:2021-10-12 22:13:19
【问题描述】:

我目前正在尝试通过 Dockerfiles 构建一些 Docker 映像。 为此,我需要从 Nexus 3 获取最新版本的 Maven Artifact。 但我似乎无法让 API 调用正常工作。

获得以下神器:

Repository: maven-releases
Group ID: eu.tuxcraft
Artifact ID: DatabaseProvider
Version: LATEST
Package Type: JAR

我用这个网址

https://maven.tuxcraft.eu/nexus/service/local/artifact/maven/redirect?r=releases&g=eu.tuxcraft&a=DatabaseProvider&v=LATEST&p=jar

这是正确的调用吗?如果不是,我需要使用什么 URL 来获取 Artifact?

Nexus 版本:OSS 3.33.0.01

【问题讨论】:

  • 那么,调用 URL 时会发生什么?
  • 我收到 404 错误
  • Maven 很久以前就弃用了 LATEST,也许 Nexus 也不再评估这个了。
  • 那么获得最新添加版本的最佳方式是什么?
  • 我不知道,你应该可以使用 REST api 来确定。

标签: api maven jar nexus nexus3


【解决方案1】:

您正在尝试将旧的 Nexus Repo 2 API 与 Nexus Repo 3.x 一起使用。有关新 API,请参见此处:

https://help.sonatype.com/display/NXRM3/Search+API#SearchAPI-DownloadingtheLatestVersionofanAsset

例子:

curl -L -X GET "http://localhost:8081/service/rest/v1/search/assets/download?sort=version&repository=maven-snapshots&maven.groupId=org.foo.bar&maven.artifactId=project&maven.extension=jar" -H "accept: application/json"

【讨论】:

    猜你喜欢
    • 2019-10-16
    • 2011-12-16
    • 2013-01-24
    • 1970-01-01
    • 2011-12-06
    • 1970-01-01
    • 2017-06-28
    • 2014-06-24
    • 2016-03-25
    相关资源
    最近更新 更多