Maven 服务器的凭据在单独的文件中

Credentials for Maven server in separate file

我使用安全的 Maven 服务器作为我项目的依赖项,并将其添加到我的 build.sbt 文件中:

resolvers ++= Seq("scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", "pexxlab" at "https://nexus.pexxlab.xyz/repository/maven-snapshots/") credentials += Credentials("Sonatype Nexus Repository Manager", "nexus.pexxlab.xyz", "username", "password")

现在这在我不是唯一开发人员的项目中不太理想,因为我不想在 Git 存储库中使用我的凭据。

有没有办法像 Maven 那样使用单独的文件向其提供我的凭据?

最简单的方法是在您的全局设置中设置凭据 (http://www.scala-sbt.org/0.13/docs/Global-Settings.html)。

Basic global configuration file

Settings that should be applied to all projects can go in ~/.sbt/0.13/global.sbt (or any file in ~/.sbt/0.13 with a .sbt extension).