尝试从Artifactory虚拟存储库下载时,SBT无法找到凭证

编程入门 行业动态 更新时间:2024-10-26 10:29:33
本文介绍了尝试从Artifactory虚拟存储库下载时,SBT无法找到凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在公司防火墙后运行SBT.另一个团队已配置了Artifactory代理.启用匿名访问后,该代理可以正常工作,但是当我们要求输入密码时,会认为密码开始出错.

I'm trying to run SBT behind a corporate firewall. Another team has configured an Artifactory proxy. This proxy works fine with anonymous access switched on, but when we make it require a password thinks start to go wrong.

当我在工作站上运行SBT时,出现以下错误:

When I run SBT on my workstation I get the following error:

[error] Unable to find credentials for [Artifactory Realm @ coderepo.xxx.amrs.bigco]

其结果是我无法引导sbt:

The result of this is that I cannot bootstrap sbt:

[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: org.scala-lang#scala-library;2.10.6: not found [warn] :: org.scala-sbt#sbt;0.13.12: not found [warn] :: org.scala-lang#scala-compiler;2.10.6: not found [warn] ::::::::::::::::::::::::::::::::::::::::::::::

我尝试将.credentials文件放入〜/.sbt以及〜/.ivy2:我一直在测试以下内容的变体,但所有这些都不起作用:

I've tried putting a .credentials file in ~/.sbt and also ~/.ivy2: I have been testing variations on the following, all of which do not work:

realm=Artifactory Realm @ coderepo.xxx.amrs.bigco host=coderepo.xxx.amrs.bigco user=<username> password=<pwd>

我猜这个错误意味着无法找到与该领域匹配的凭据定义,因此我在两个位置都尝试了许多第一行的版本:

I'm guessing that this error means that it was unable to locate a credentials definition that matched the realm, so I tried a number of versions of the first line in both locations:

realm=Artifactory Realm realm=[Artifactory Realm @ coderepo.xxx.amrs.bigco] realm=coderepo.xxx.amrs.bigco

似乎没有任何影响.

那么,允许SBT使用用户名&进行身份验证的正确方法是什么?密码到受密码保护的Artifactory存储库?

So what is the correct way to allow SBT to authenticate with username & password to a password protected Artifactory repository?

UPDATE0 :根据Ivy文档,最可能的领域名称只是"Artifactory Realm".根据SBT文档,凭据文件的正确默认位置应为%USERPROFILE%/.sbt/.credentials(是的,我使用的是Windows).即使删除了我的.ivy2目录中的.credentials文件,它仍然不起作用.

UPDATE0: According to the Ivy documentation, the most likely realm name is simply "Artifactory Realm". According to the SBT documentation, the correct default location of the credentials file should be %USERPROFILE%/.sbt/.credentials (yes, I'm using Windows). Even after deleting the .credentials file in my .ivy2 directory it still doesn't work.

UPDATE1 :相关但没有实际帮助:

UPDATE1: Relevant but not actually helpful:

  • 发布到Artifactory时SBT没有通过凭据
  • Sbt无法在Artifactory中进行授权
  • SBT not passing credentials when publishing to Artifactory
  • Sbt can't authorize in Artifactory

UPDATE2 :我开始怀疑这是sbt中的错误-我在这里添加了一个问题: github/sbt/sbt/issues/2817

UPDATE2: I'm starting to suspect that this is a bug in sbt - I've added an issue here: github/sbt/sbt/issues/2817

推荐答案

请参见该问题,以获取有关如何配置全局凭据的详细信息.

See this question for details on how to configure global credentials.

总结一下:

如果您需要从代理存储库启动SBT,请将系统属性sbt.boot.credentials设置为指向您的凭据文件.您可以在%CSIDL_PROGRAM_FILESX86%/sbt/conf/sbtconfig.txt中执行此操作,例如:

If you need to boot SBT from a proxy repository, set the system property sbt.boot.credentials to point to your credentials file. You can do this in your %CSIDL_PROGRAM_FILESX86%/sbt/conf/sbtconfig.txt, for example:

-Dsbt.boot.credentials=/Users/my-user-name/.sbt/credentials

或者,您可以将SBT_CREDENTIALS环境变量用于相同的目的.

Alternatively you can use the SBT_CREDENTIALS environment variable for the same purpose.

对于Artifactory,credentials文件中的领域应设置为:

For Artifactory, the realm in the credentials file should be set to:

realm=Artifactory Realm

要验证依赖项工件检索,请使用credentials设置创建类似%USERPROFILE%/.sbt/0.13/plugins/my-credentials.sbt的文件.例如:

For authenticating dependency artifact retrieval, create a file like %USERPROFILE%/.sbt/0.13/plugins/my-credentials.sbt with a credentials setting. For example:

credentials += Credentials(Path.userHome / ".sbt" / "credentials")

更多推荐

尝试从Artifactory虚拟存储库下载时,SBT无法找到凭证

本文发布于:2023-07-24 13:18:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1203677.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:凭证   Artifactory   SBT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!