sbt:如何依赖git项目的子模块

时间:2016-08-11 22:58:47

标签: scala github sbt smile

我的项目取决于:

"com.github.haifengl" % "smile-core" % "1.1.0",
"com.github.haifengl" % "smile-scala_2.11" % "1.1.0",

并希望修改sbt以使用github中同一项目的最新master。

我已经用这样的其他项目完成了这个:

lazy val myProject = Project("myProject", file("."))
  .settings(commonSettings: _*)
  .dependsOn(smileProject)


lazy val smileProject = RootProject(uri("https://github.com/haifengl/smile"))

然而,这失败了:

 unresolved dependency: default#smile_2.11;0.1-SNAPSHOT: not found

哪种有道理。关注this example

lazy val smileProject = ProjectRef(uri("https://github.com/haifengl/smile"), "smile-core")

我明白了:

[error] No project 'smile-core' in 'https://github.com/haifengl/smile'.
[error] Valid project IDs: smile

smile-core似乎是正确的名称。

更新:添加.git扩展名

lazy val smileProject = ProjectRef(uri("https://github.com/haifengl/smile.git"), "smile-core")

也给出了:

[error] No project 'smile-core' in 'https://github.com/haifengl/smile.git'.
[error] Valid project IDs: benchmark, core, data, demo, graph, interpolation, math, nlp, plot, root, scala, shell

......这似乎是一种改进

1 个答案:

答案 0 :(得分:2)

您可以查看这是否是" Git Subproject Compile-time Dependencies in Sbt"从2015年起可以发挥作用:

lazy val root = Project("root", sbt.file(".")).dependsOn(smileProject, ...)
lazy val smileProject = ProjectRef(uri("https://github.com/haifengl/smile.git"), "core")