我有一个与stagin pl一起使用的小项目
[INFO] * Remote staging into staging profile ID "29ad9cd35d5f3"
[INFO] * Created staging repository with ID "bizaqutebnd-1010".
[INFO] * Staging repository at http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/bizaqutebnd-1010
[INFO] * Uploading locally staged artifacts to profile biz.aQute.bnd
Uploading: http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/bizaqutebnd-1010/biz/aQute/bnd/test.maven/1.0.1/test.maven-1.0.1.pom.asc
[ERROR] Remote staging finished with a failure: Failed to deploy artifacts: Could not transfer artifact biz.aQute.bnd:test.maven:pom.asc:1.0.1
from/to local (http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/bizaqutebnd-1010):
Failed to transfer file: http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/bizaqutebnd-1010/biz/aQute/bnd/test.maven/1.0.1/test.maven-1.0.1.pom.asc.
Return code is: 401, ReasonPhrase: Unauthorized.
由于我可以创建暂存存储库,因此我似乎不可避免地获得了许可。使用curl命令测试上传:
curl -u admin:admin123 -X PUT -H Content-Type:foo --data @ pom.xml http://localhost:8081/nexus/service/local/staging/deployByRepositoryId/bizaqutebnd-1009/biz/aQute/bnd/test.maven/1.0.1/test.maven-1.0.1.pom.asc
哪个成功没有错误。
完全不解......
答案 0 :(得分:0)
结果表明,当使用Java进行通信时,Nexus的反应非常不同。通过将User-Agent标头设置为Java默认值以外的其他内容来解决此问题。
可能Nexus为旧的Maven版本提供了一些向后兼容性代码。