SBT不使用基于ssh的解析器来解析依赖关系

时间:2013-05-03 13:56:19

标签: sbt

我的build.sbt中有以下定义:

libraryDependencies += "com.bubblefoundry" %% "something" % "0.1-SNAPSHOT"

resolvers += {
  val privateKeyFile = new java.io.File(sys.env("HOME") + "/.ssh/id_rsa")
  Resolver.ssh("Bubble Foundry", "bubblefoundry.com", "/usr/local/repository/") as ("peter", privateKeyFile) withPermissions("0644")
}

当sbt尝试解析依赖关系时,它会失败:

[info] Resolving com.bubblefoundry#something_2.10;0.1-SNAPSHOT ...
[warn]  module not found: com.bubblefoundry#something_2.10;0.1-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/peter/.ivy2/local/com.bubblefoundry/something_2.10/0.1-SNAPSHOT/ivys/ivy.xml
[warn] ==== Bubble Foundry: tried
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com.bubblefoundry/something_2.10/0.1-SNAPSHOT/something_2.10-0.1-SNAPSHOT.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.bubblefoundry#something_2.10;0.1-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

它似乎甚至没有连接到服务器来查找依赖项。这是为什么?我做错了吗?

依赖关系已发布(使用相同的解析器定义)到/usr/local/repository/com/bubblefoundry/...

2 个答案:

答案 0 :(得分:0)

更新到sbt 0.13之后,我可以通过将以下行添加到build.sbt来使用我的私人仓库

resolvers += Resolver.ssh("Company Maven Repo", "git@github.com:company/company-repo.git", "/raw/master")

弹出一个对话框,询问我的github用户名和密码


这是一个错误!

例如,我使用github来托管通过SSH访问的私有/内部maven仓库。当您使用Maven / POM文件时,我可以毫无困难地提取工件。

但是不能让SBT(0.12.2)起作用。最令人沮丧的是它只是说

== REPO_NAME: tried

即使我指定了无效的身份验证或提供了错误的ssh网址,它也会做同样的事情,即没有错误报告。

花了几个小时研究并尝试组合无济于事。因此我建议SSH repos不能正常工作。

答案 1 :(得分:-1)

我找到了一个解决方案:从ssh切换到sftp

resolvers += {
  val privateKeyFile = new java.io.File(sys.env("HOME") + "/.ssh/id_rsa")
  Resolver.sftp("Bubble Foundry", "bubblefoundry.com", "/usr/local/repository/") as ("peter", privateKeyFile)
}