Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I provide URL access to the latest snapshot of an artifact in Nexus 2.x?

Tags:

maven

nexus

I would like to provide a simple URL that will always return the latest version of a snapshot version of an artifact. By simple I mean that the URL doesn't change, or require the user to browse the directory and examine timestamps.

like image 453
chad Avatar asked Feb 14 '12 16:02

chad


People also ask

Why are snapshot repositories used in Nexus?

By definition, snapshots are mutable, releases are immutable. This is why Nexus makes you store them separately because usually you don't care if you lose snapshots, but you will care if you lose releases. It makes snapshot cleanup much easier to deal with that way.

What is artifact snapshot?

Snapshot artifacts are artifacts generated during the development of a software project. A Snapshot artifact has both a version number such as “1.3.


1 Answers

Please note

  • this answer relates to Nexus 2.X
  • There is a noticeable performance impact of using the restlet API to download large artifacts, see: https://community.sonatype.com/t/slow-artefacts-download-performance-with-oss-2-x/2280

The core Nexus "redirect" REST API can be used to retrieve any version of an artifact from a nominated repository:

For example:

https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST

The v parameter can be a value like 1.0-SNAPSHOT, in which case Maven will return the latest time-stamped snapshot held in the repository. Similiarily the special value "LATEST" should do the same provided a more recent released version is not present.

like image 138
Mark O'Connor Avatar answered Oct 25 '22 03:10

Mark O'Connor