【问题标题】:Where should the SBT credentials configuration go?SBT 凭证配置应该放在哪里?
【发布时间】:2018-08-16 20:48:47
【问题描述】:

我在 Windows 上运行 SBT 1.1.1。

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

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

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

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

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

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

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

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。

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

【问题讨论】:

    标签: sbt


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-26
      • 2014-03-06
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 2019-04-18
      • 1970-01-01
      相关资源
      最近更新 更多