Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonatype Nexus REST Api fetch latest build version

Tags:

How can I can use the Sonatype REST Api to fetch the build with the highest version (latest temporal build)?

http://MY_REPOSITORY/nexus/service/local/lucene/search?a=ARTIFACT_NAME&v=ARTIFACT_VERSION

Passing a build version as ARTIFACT_VERSION works. Passing v=LATEST or v=latest does NOT return the latest build.

like image 369
Giorgio Avatar asked Feb 09 '13 01:02

Giorgio


People also ask

Does Nexus have an API?

Nexus Repository Manager (NXRM) has new supported REST API endpoints that can automate your binary management needs. REST APIs allow clients to interact with an application, providing them with the capabilities of retrieving and transforming application data.

What is Sonatype nexus?

Nexus by Sonatype is a repository manager that organizes, stores and distributes artifacts needed for development. With Nexus, developers can completely control access to, and deployment of, every artifact in an organization from a single location, making it easier to distribute software.


1 Answers

It is not documented that /service/local/lucene/search support "LATEST" as version parameter [link] The OSS rest api documentation states that /service/local/artifact/maven [link] (to get the artifact pom file) and /service/local/artifact/maven/content [link] (to get the actual file content) does support it:

Version of the artifact (Required) Supports resolving of "LATEST", "RELEASE" and snapshot versions ("1.0-SNAPSHOT") too.

So I think you should use one of them (you will have to supply them also with repositoryId and groupId) for example:

http://MY_REPOSITORY/nexus/service/local/artifact/maven/content?r=repoId&g=groupName&a=art&v=LATEST
like image 112
Ido.Co Avatar answered Sep 29 '22 19:09

Ido.Co