[ACCEPTED]-How do I provide URL access to the latest snapshot of an artifact in Nexus 2.x?-nexus

Accepted answer
Score: 61

Please note

The core Nexus "redirect" REST API can 8 be used to retrieve any version of an artifact 7 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 6 v parameter can be a value like 1.0-SNAPSHOT, in 5 which case Maven will return the latest 4 time-stamped snapshot held in the repository. Similiarily 3 the special value "LATEST" should 2 do the same provided a more recent released 1 version is not present.

Score: 3

on my nexus machine all results for :

http://nexushost.domain/nexus/content/repositories/snapshots/com/company/elasticsearch-river-mongodb/1.2.3-SNAPSHOT/

are 9 like this: *-1.2.3-20131204.143026-1.zip

so 8 I can't access it directly because I need 7 to provide more details that are dynamic.

The 6 example with "...redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST" is 5 working if I open in browser but not when 4 I what to install it from some linux machine 3 using:

/usr/share/elasticsearch/bin/plugin --url "http://localhost:8081/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.comapny.application&a=elasticsearch-river-mongodb&v=1.2.3-SNAPSHOT&p=zip" --install river-mongodb

So my temporary solution is using 2 wget :

wget -O /tmp/elasticsearch-river-mongodb.zip "http://nexushost.domain/nexus/service/local/artifact/maven/redirect?r=snapshots&g=com.comapny.application&a=elasticsearch-river-mongodb&v=1.2.3-SNAPSHOT&p=zip"

then install LATEST version from local 1 file.

Score: 3

If you're looking for the latest version 17 of a snapshot, just asking for say, "1.0-SNAPSHOT" will 16 return the latest version of that artifact's 15 snapshot.

If you're looking for "latest version" however, the 14 "v=LATEST" syntax will work, but keep in 13 mind that this keyword can return the latest 12 version of that snapshot you're looking 11 for, or the release that just completed, or 10 that OTHER branch of that same artifact 9 that is a version ahead and still at "-SNAPSHOT".

If 8 you're looking for the absolute latest then 7 yeah, use the "v=LATEST". If you're looking 6 for the latest release, you can also ask 5 for "v=RELEASE". If you have a grouping 4 of repos, you can reference both snapshot 3 repos and release repositories by adding 2 to the url something like:

"...v=RELEASE&r=public"

That 1 should search across all your "grouped" repos.

More Related questions