【问题标题】:SBT 1.1.1 not using credentials for Nexus proxySBT 1.1.1 不使用 Nexus 代理的凭据
【发布时间】:2021-01-18 22:36:47
【问题描述】:

我们移至一个新的经过身份验证的 Nexus,以充当获取依赖项的代理。 我试图以多种方式为 SBT (1.1.1) 提供所需的凭据,但我总是最终得到:

[error] Unable to find credentials for [Sonatype Nexus Repository Manager @ nexus3.company.com]
[debug] CLIENT ERROR: Unauthorized url=https://nexus3.company.com/repository/maven2-proxy-all/org/scala-sbt/actions_2.12/1.1.1/actions_2.12-1.1.1.pom

对于很多依赖项都会重复。

我在我的项目中创建了一个 .credentials 文件,如下所示:

realm=Sonatype Nexus Repository Manager 
host=nexus3.company.com
user=xxxxx
password=xxxxx

这是我尝试过的,基于我从互联网上其他线程获得的输入:

  • 在命令中添加此凭据文件的路径:-Dsbt.boot.credentials=.credentials
  • 将此凭据文件的路径添加到环境变量:$SBT_CREDENTIALS = PATH
  • 在 build.sbt 中添加以下行:credentials += Credentials(new File(".credentials"))
  • 在 build.sbt 中添加以下行:credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", "xxxxx", "xxxxxx")
  • 检查代理的情况:我的请求似乎没有任何授权标头,并且全部返回为 HTTP 401

然而,当我使用文件中的凭据从同一台机器访问提到的 URL 时,根本没有问题。

我的想法已经用完了:(

【问题讨论】:

    标签: sbt nexus


    【解决方案1】:

    经过多次尝试,添加:

    ~/.sbt/1.0/credentials.sbt credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", USER, PWD)

    上面提到的 SBT_CREDENTIALS 变量,

    似乎完成了这项工作。 我还更新了我们用于管道的图像,不确定是否有帮助。

    【讨论】:

      猜你喜欢
      • 2016-06-25
      • 1970-01-01
      • 2016-12-30
      • 2011-04-15
      • 2017-02-18
      • 2015-12-04
      • 2017-01-08
      • 2021-04-11
      • 2018-12-06
      相关资源
      最近更新 更多