我正在尝试在公司防火墙后运行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无法找到凭证
发布评论