我正在尝试访问需要一些基本身份验证的Nexus存储库管理器.从Maven2开始,一切正常,但是当我尝试在SBT中配置时,它找不到工件.它使用的是自定义存储库模式(请参阅此相关问题),但我认为这不重要.在任何情况下,相关配置都在这里.
Project.scala:
val snapshotsName = "Repository Snapshots"
val snapshotsUrl = new java.net.URL("http://nexusHostIp:8081/nexus/content/repositories/snapshots")
val snapshotsPattern = "[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision](-[timestamp]).[ext]"
val snapshots = Resolver.url(snapshotsName, snapshotsUrl)(Patterns(snapshotsPattern))
Credentials(Path.userHome / ".ivy2" / ".credentials", log)
val dep = "group" % "artifact" % "0.0.1" extra("timestamp" -> "20101202.195418-3")
Run Code Online (Sandbox Code Playgroud)
〜/ .ivy2/.credentials:
realm=Snapshots Nexus
host=nexusHostIp:8081
user=nexususername
password=nexuspassword
Run Code Online (Sandbox Code Playgroud)
根据SBT用户组中的类似讨论,这应该可以正常工作,但是当我尝试构建时,我得到以下内容.
==== Repository Snapshots: tried
[warn] -- artifact group#artifact;0.0.1!artifact.jar:
[warn] http://nexusHostIp:8081/nexus/content/repositories/snapshots/group/artifact/0.0.1-SNAPSHOT/artifact-0.0.1-20101202.195418-3.jar
Run Code Online (Sandbox Code Playgroud)
我相当肯定这是一个凭证问题,而不是别的因为我可以点击它说它正在尝试的URL并下载jar(在验证之后).
我也试过内联声明凭证(即使它不太理想),如下所示:
Credentials.add("Repository Snapshots", "nexusHostIp", "nexususername", "nexuspassword")
Run Code Online (Sandbox Code Playgroud) 我正在使用 IntelliJ IDEA Ultimate 导入一个 SBT 项目,该项目在私有 Artifactory 中有一些插件。
[info] Resolving com.private#XXXX_X.X;X.X.X-SNAPSHOT ...
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].
Run Code Online (Sandbox Code Playgroud)
我确实在 SBT 中配置了 Artifactory 凭据,并且如果我使用 sbt shell 构建项目,则工作正常;但是,IntelliJ 中的构建失败并且无法识别凭据。有人可以帮忙吗?
更新:当插件是快照版本时,这似乎是唯一的问题。
预先非常感谢您!
我正在尝试从我的私人仓库中获取一些依赖项,但是 sbt 似乎无法找到凭据。每当我尝试获取依赖项时,我的终端中也会出现错误
[error] Unable to find credentials for [Artifactory Realm @ artifactory.mydomain.com].
Run Code Online (Sandbox Code Playgroud)
我已经阅读了几个答案,但没有一个对我有用。到目前为止我做了什么:
1)我配置了我的回购
cat ~/.sbt/repositories
[repositories]
local
my-ivy-proxy-releases: https://artifactory.mydomain.com/my-ivy-release-local/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
my-maven-proxy-releases: https://artifactory.mydomain.com/my-ivy-release-local/
Run Code Online (Sandbox Code Playgroud)
2)我创建了一个 .credentials 文件
cat ~/.sbt/.credentials
realm=Artifactory Realm
host=artifactory.mydomain.com
user=myuser
password=mypassword
Run Code Online (Sandbox Code Playgroud)
3)我导出了环境变量 SBT_CREDENTIALS
export SBT_CREDENTIALS=/Users/myuser/.sbt/.credentials
Run Code Online (Sandbox Code Playgroud)
4)我在 ~/.sbt/0.13/credentials 以及 ~/.sbt/0.13/plugins/credentials 中创建了credentials.sbt
cat ~/.sbt/0.13/credentials.sbt
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
Run Code Online (Sandbox Code Playgroud)
当我尝试使用 curl 访问依赖项时,一切正常。
我已经阅读了一些所谓的解决方案,包括:
我发出sbt publish命令,并得到一个提示,要求我输入用户名和密码。我可以在 build.sbt 或其他地方提供它们,所以我不必手动输入它们吗?
在我的 build.sbt 文件中,我有这个:
publishTo := Some(Resolver.sftp("Server", "url", "port"))
Run Code Online (Sandbox Code Playgroud)