如何使用Sonatype Nexus的wget下载工件

dr0*_*0n3 14 linux wget nexus sonatype

我启动并运行了一个Sonatype Nexus实例,需要编写一个脚本来手动下载特定的工件.

我尝试使用REST API和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.
Run Code Online (Sandbox Code Playgroud)

有谁知道,如何使这个工作?

编辑:我可以使用我的浏览器下载工件(并登录到Web界面)

rse*_*don 24

URL看起来正确,但您必须引用它,因为它包含特殊字符.

wget --user=username --password=password "http://<ip>:<port>/nexus/service/local/artifact/maven/content?g=<group>&a=<artifact>&v=<version>&r=snapshots"
Run Code Online (Sandbox Code Playgroud)

您还可能希望添加--content-disposition以便下载的文件名正确.浏览此处获取更多信息:

https://support.sonatype.com/entries/23674267