Sonatype Nexus 3 - get latest snapshot

Daniel picture Daniel · May 17, 2016 · Viewed 14k times · Source

We've just upgraded out nexus installation to the latest release (3.x). Is there any way to get the latest version of a given snapshot artifact? Nexus 2 had a nice API which is not supported anymore.

Same question (but for the old version) has been answered here: Sonatype Nexus REST Api fetch latest build version

Any ideas are highly appreciated.

Best, Daniel

Answer

Peter Lynch picture Peter Lynch · Jan 9, 2017

Nexus 2 had a nice API which is not supported anymore.

It sounds like you are referring to these:

/service/local/artifact/maven/content
/service/local/artifact/maven/redirect

If you're asking to find the latest x.y.z-SNAPSHOT version where the x, y, z are guessed - Nexus never had this functionality (it worked only for plugins).

This is simply untrue - see the following article which shows clearly you can specify LATEST, RELEASE or SNAPSHOT base versions.

https://support.sonatype.com/hc/en-us/articles/213465488-How-can-I-retrieve-a-snapshot-if-I-don-t-know-the-exact-filename-

It's possible but not in a 1-liner.

Yes - unless you have a tool handy such as artifact-resolver which does uses a one line command to fetch an artifact.