I got a Sonatype Nexus instance up and running and need to write a script to download a specific artifact manually.
I tried using the REST API and wget:
wget --user=username --password=password http://<ip>:<port>/nexus/service/local/artifact/maven/content?g=<group>&a=<artifact>&v=<version>&r=snapshots
Resolving <ip stuff>
Connecting to <ipv6 stuff>... failed: Connection refused.
Connecting to <ipv4 stuff>... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to <ip>:<port>.
HTTP request sent, awaiting response... 400 Bad Request
2014-05-11 20:17:01 ERROR 400: Bad Request.
Does anyone know, how to get this to work?
Edit: I'm able to download the artifact using my browser (and being logged in to the webinterface)
The URL looks correct, but you're to have to quote it because it contains special characters.
wget --user=username --password=password "http://<ip>:<port>/nexus/service/local/artifact/maven/content?g=<group>&a=<artifact>&v=<version>&r=snapshots"
You also might want to add --content-disposition
in order for the downloaded file name to be correct. See here for more information: