【问题标题】:sbt: how to depend on sub module of a git projectsbt:如何依赖 git 项目的子模块
【发布时间】:2016-12-18 20:10:42
【问题描述】:

我有一个项目依赖于:

"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

...这似乎是一种改进

【问题讨论】:

  • 看起来您在 URL 中缺少 .git 扩展名:ProjectRef(uri("https://github.com/haifengl/smile.git"), "smile-core")
  • 没有帮助。已更新问题。
  • 啊——确实有帮助。模块名称错误。

标签: scala github sbt smile


【解决方案1】:

您可以检查 2015 年的“Git Subproject Compile-time Dependencies in Sbt”是否可以工作:

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

【讨论】:

  • 没什么区别:我得到“github.com/haifengl/smile.git' 中没有项目 'smile-core'。”
  • 啊——需要.git扩展名和“smile-core”->“core”作为模块。
猜你喜欢
  • 2015-11-10
  • 2011-08-27
  • 1970-01-01
  • 2011-05-30
  • 1970-01-01
  • 2014-02-17
  • 2018-03-20
  • 2020-04-11
  • 1970-01-01
相关资源
最近更新 更多