How do I provide URL access to the latest snapshot of an artifact in Nexus 2.x?
on my nexus machine all results for :
http://nexushost.domain/nexus/content/repositories/snapshots/com/company/elasticsearch-river-mongodb/1.2.3-SNAPSHOT/
are like this: *-1.2.3-20131204.143026-1.zip
so I can't access it directly because I need to provide more details that are dynamic.
The example with "...redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST" is working if I open in browser but not when I what to install it from some linux machine 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 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 file.
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.