user48956 user48956 - 5 months ago 57
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: _*)

lazy val smileProject = RootProject(uri(""))

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(""), "smile-core")

I get:

[error] No project 'smile-core' in ''.
[error] Valid project IDs: smile

smile-core seems like the right name.

UPDATE: Adding the .git extension

lazy val smileProject = ProjectRef(uri(""), "smile-core")

also gives:

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

... which seems like an improvement


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(""), "smile-core")