user48956 user48956 - 3 months ago 51
Scala Question

sbt: how to depend on sub module of a git project

I have a project that depends on:

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


and want to modify sbt to use the latest master of the same project from github.

I've done this with other projects like this:

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


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


However, this fails with:

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


which kinda makes sense. Following this example

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


I get:

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


smile-core seems like the right name.

UPDATE: Adding the .git extension

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


also gives:

[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


... which seems like an improvement

Answer

You can check if this "Git Subproject Compile-time Dependencies in Sbt" from 2015 could work:

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