使用 wget 和 Nexus Rest 的奇怪文件命名 API

Odd file naming using wget with Nexus Rest API

我有一个脚本可以使用 wget 从我们的 Nexus 存储库中提取 .war 工件,通过 Nexus Rest API.

提取工件

我用wget打的url类似这样:

http://our.nexus.net:8081/nexus/service/local/artifact/maven/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war

它在我们的开发环境中运行良好,并提取了一个名为 SomeArtifact-1.0.0.war.

的工件

然而,在我们的测试环境中,它正确地拉取了工件,但给它命名:

redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war

关于为什么没有正确重命名的任何想法?

这是 wget 命名错误时的示例输出。

--2015-05-11 11:22:12-- http://our.nexus.net:8081/nexus/service/local/artifact/maven/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war
Resolving our.nexus.net... (IP)
Connecting to our.nexus.net|(IP)|:8081... connected.
HTTP request sent, awaiting response... 307 Temporary Redirect
Location: http://our.nexus.net:8081/nexus/service/local/repositories/releases/content/com/somecompany/SomeArtifact/1.0.0/SomeArtifact-1.0.0.war [following]
--2015-05-11 11:22:12-- http://our.nexus.net:8081/nexus/service/local/repositories/releases/content/com/somecompany/SomeArtifact/1.0.0/SomeArtifact-1.0.0.war
Reusing existing connection to our.nexus.net:8081.
HTTP request sent, awaiting response... 200 OK
Length: 22046212 (21M) [application/java-archive]
Saving to: "/tmp/deploy/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war"

100%[======================================================>] 22,046,212 56.7M/s in 0.4s

2015-05-11 11:22:12 (56.7 MB/s) - "/tmp/deploy/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war" saved [22046212/22046212]

当它正确命名时:

--2015-05-11 11:22:12-- http://our.nexus.net:8081/nexus/service/local/artifact/maven/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war
Resolving our.nexus.net... (IP)
Connecting to our.nexus.net|(IP)|:8081... connected.
HTTP request sent, awaiting response... 307 Temporary Redirect
Location: http://our.nexus.net:8081/nexus/service/local/repositories/releases/content/com/somecompany/SomeArtifact/1.0.0/SomeArtifact-1.0.0.war [following]
--2015-05-11 11:22:12-- http://our.nexus.net:8081/nexus/service/local/repositories/releases/content/com/somecompany/SomeArtifact/1.0.0/SomeArtifact-1.0.0.war
Reusing existing connection to our.nexus.net:8081.
HTTP request sent, awaiting response... 200 OK
Length: 22046212 (21M) [application/java-archive]
Saving to: "/tmp/deploy/SomeArtifact-1.0.0.war"

100%[======================================================>] 22,046,212 56.7M/s in 0.4s

2015-05-11 11:22:12 (56.7 MB/s) - "/tmp/deploy/SomeArtifact.1.0.0.war" saved [22046212/22046212]

编辑:下面的一些附加信息。

开发和测试环境都有wget版本1.12。

它工作的开发服务器是 运行 RedHat Enterprise Linux OS 版本 6.4。 测试服务器,它不起作用的版本是 6.6.

看来问题是 RedHat Enterprise Linux OS 版本 6.4 与 6.6 中 wget 设置的差异。

我最后只是在 wget 中使用了 -O 标志来确保文件名是我想要的。

wget -O SomeArtifact.1.0.0.war "http://our.nexus.net:8081/nexus/service/local/artifact/maven/redirect?g=com.somecompany&a=SomeArtifact&v=1.0.0&r=releases&p=war"