Question

I'm trying to use the Maven central API to provide dynamic download links for the latest versions of an artifact. While this works for a normal jar, I cannot seem to get it to link to the 'jar-with-dependencies' version of the artifact.

Using the com.ning:nagios artifact, the latest can be downloaded at

http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.ning&a=nagios&v=LATEST

I had assumed that I could use the l query param (based on the linked API) to specify the 'jar-with-dependencies' classifier but the link only downloads the normal jar.

http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.ning&a=nagios&v=LATEST&l=jar-with-dependencies

Is there any way to link to this version of the artifact?

Was it helpful?

Solution

It turns out the classifier parameter is 'c' for the redirecting download service, not 'l' as used in the Solr API (in that API 'c' is for 'classname') - so this will work:

https://search.maven.org/remote_content?g=com.ning&a=nagios&v=LATEST&c=jar-with-dependencies

(note, updated after Sonatype put BASIC auth on the old url - we use this new official download url on maven.org instead now)

It downloads the 1.2MB jar that includes dependencies (not the regular jar) - currently the latest version is nagios-0.0.2-jar-with-dependencies.jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top