SBT 凭据配置应该放在哪里? [英] Where should the SBT credentials configuration go?

查看:39
本文介绍了SBT 凭据配置应该放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 上运行 SBT 1.1.1.

I'm running SBT 1.1.1 on Windows.

如果我在 build.sbt 中加入以下行,我的构建就可以了:

If I put the following line in my build.sbt, my build is OK:

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

问题是,我并不特别想在我的项目中留下这种特定于机器的配置.此外,为了使用 g8 模板,我需要有一个有效的全局配置.

The trouble is, I don't particularly want to leave this kind of machine-specific configuration in my project. Also, in order to use g8 templates I need to have a working global config.

但是如果我将相同的文本放在以下目录中名为 credentials.sbt 的文件中,它似乎不起作用.

But if I put the same text in a file called credentials.sbt in the following directories it seems not to work.

  • %USERPROFILE%/.sbt/1.1/plugins/credentials.sbt
  • %USERPROFILE%/.sbt/1.1/credentials.sbt
  • %USERPROFILE%/.sbt/plugins/credentials.sbt

那么这个文件应该去哪里呢?

So where should this file go?

无论我将文件放在哪个位置,都会出现以下错误:

Whichever location I put the file in I get the following errors:

C:\workspace\tmp>c:\apps\sbt-1.1.1\bin\sbt.bat new sbt/scala-seed.g8
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading settings from credentials.sbt ...
[info] Loading global plugins from C:\Users\NBKA0O5\.sbt\1.0\plugins
[info] Updating ProjectRef(uri("file:/C:/Users/NBKA0O5/.sbt/1.0/plugins/"), "global-plugins")...
[error] Unable to find credentials for [Artifactory Realm @ artifactory.company.com].
[error] Unable to find credentials for [Artifactory Realm @ artifactory.company.com].

我知道我的凭据必须是好的,因为我首先使用完全相同的凭据来启动 SBT.

I know that my credentials must be good because I use the exact same credentials to boot SBT in the first place.

奇怪的是,即使我正在运行 sbt-1.1.1,它似乎也想从 %USERPROFILE%\.sbt\1.0\plugins 加载插件 - 这对我来说意义不大,版本号不匹配.即使我知道正在读取文件,我仍然收到错误消息.

Bizarrely, even though I'm running sbt-1.1.1 it seems to be wanting to load plugins from %USERPROFILE%\.sbt\1.0\plugins - which makes very little sense to me, the version numbers do not match. Even though I know the file is being read I still get the error messages.

推荐答案

奇怪的是,即使我正在运行 sbt-1.1.1,它似乎也想从 %USERPROFILE%.sbt\1.0\plugins 加载插件 - 这对我来说意义不大,版本号不匹配.

Bizarrely, even though I'm running sbt-1.1.1 it seems to be wanting to load plugins from %USERPROFILE%.sbt\1.0\plugins - which makes very little sense to me, the version numbers do not match.

有关此问题,请参阅 sbt/sbt#3858.您应该将您的凭据文件放在 ~/.sbt/1.0/credentials.sbt(与任何其他全局设置相同).

See sbt/sbt#3858 about this issue. You should put your credentials file in ~/.sbt/1.0/credentials.sbt (same as any other global settings).

另请注意,credentials 是自 sbt 1.0 以来的一项任务,因此如果您必须将实际凭据存储在其他地方(环境变量或从另一个文件解析),则每次都应重新评估正在使用中.

Also notice that credentials is a task since sbt 1.0, so in case you will have to store your actual credentials somewhere else (environment variables or parse from another file), it should be reevaluated every time it's being used.

这篇关于SBT 凭据配置应该放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆