【发布时间】:2012-06-02 03:38:55
【问题描述】:
我的本地存储库中的 maven 依赖项存在问题。
SBT 找不到它。已将日志级别设置为调试,但没有任何新内容。
文件在存储库中。我将粘贴路径从控制台复制到文件资源管理器,它们就在那里。
输出:
[debug] trying file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0.0/naggati-2.0.0.pom
[debug] tried file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0.0/naggati-2.0.0.pom
[debug] Local Maven Repository: resource not reachable for com/twitter#naggati;2.0.0: res=file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0
.0/naggati-2.0.0.pom
[debug] trying file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0.0/naggati-2.0.0.jar
[debug] tried file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0.0/naggati-2.0.0.jar
[debug] Local Maven Repository: resource not reachable for com/twitter#naggati;2.0.0: res=file://c:/Users/userz/.m2/repository/com/twitter/naggati/2.0
.0/naggati-2.0.0.jar
[debug] Local Maven Repository: no ivy file nor artifact found for com.twitter#naggati;2.0.0
编辑:我在 project/build 中使用 scala 文件添加了路径,如http://code.google.com/p/simple-build-tool/wiki/LibraryManagement中所述
"如果你把它添加为仓库,sbt 可以搜索你本地的 Maven 仓库:"
val mavenLocal = "Local Maven Repository" at "file://"+Path.userHome+"/.m2/repository"
这使得 sbt 在本地存储库中查找。之前没有。
所以 scala 文件看起来像这样:
import sbt._
class Foo(info: ProjectInfo) extends DefaultProject(info) {
val mavenLocal = "Local Maven Repository" at "file://c:/Users/userz/.m2/repository"
}
(我硬编码 Path.userHome 以排除可能的错误原因。正如预期的那样,它没有改变任何东西)。
【问题讨论】:
-
你必须将本地 maven repo 添加到你的 build.sbt
-
存储库已添加,否则脚本不会在那里查找文件。
-
告诉 sbt 寻找你的依赖的那一行是怎样的?如果你有类似 ... -> 默认的东西,请从那里删除默认值。
-
其实我没有使用 build.sbt。我正在使用 code.google.com/p/simple-build-tool/wiki/LibraryManagement 中描述的 scala 文件。用更多细节编辑了我的帖子。
-
ixx:这是 SBT 0.7.x,它是旧版本。如果可能,您应该更新到 [SBT 0.11.x])github.com/harrah/xsbt/wiki)。