【问题标题】:Nexus Pro is fine with staging repository create but fails with 401 Unauthorized on uploadNexus Pro 可以很好地创建临时存储库,但上传失败并显示 401 Unauthorized
【发布时间】:2016-10-03 15:40:16
【问题描述】:

我有一个与 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

成功且没有错误。

一脸懵逼……

【问题讨论】:

    标签: maven nexus staging


    【解决方案1】:

    事实证明,当使用 Java 进行通信时,Nexus 的反应非常不同。通过将 User-Agent 标头设置为 Java 默认值以外的其他值,此问题已得到解决。

    可能 Nexus 有一些针对旧 Maven 版本的向后兼容代码。

    【讨论】:

      猜你喜欢
      • 2021-06-14
      • 2022-12-25
      • 1970-01-01
      • 2014-11-18
      • 1970-01-01
      • 2018-03-07
      • 2016-02-11
      • 1970-01-01
      • 2014-03-23
      相关资源
      最近更新 更多