Reputation: 39366
In SBT it is possible to depend directly on another project. This has the advantage that when running ~compile
, a change to the dependency causes a rebuild.
Now I want to depend on a subproject of another project, without depending on any of its siblings. So, for example, I have:
a/
build.sbt
b/
build.sbt
c/
build.sbt
d/
build.sbt
and I want d
to depend on b
but not on c
.
I tried, in d/build.sbt
,
lazy val d = ProjectRef(file("../a"), "b")
lazy val root = project.dependsOn(d)
but this gives
Note: Unresolved dependencies path:
com.foo:a_2.10:1.0
+- root:root_2.10:1.0
I could of course do
lazy val d = RootProject(file("../a/b"))
except that it is possible for a/build.sbt
to contain additional settings for a/b
that won't be pickup up this way. I need a reference that will pick up a/build.sbt
but also refer specifically to a/b
.
Is there any way to make this sort of reference?
Upvotes: 3
Views: 1548
Reputation: 39366
It was just a stupid mistake on my part.
lazy val root = project
is not correct. That line of code creates a subproject in a directory called root/
. The correct way to refer to the root project is:
lazy val root = Project(id = "root", base = file("."))
after that,
lazy val d = ProjectRef(file("../a"), "b")
lazy val root = Project(id = "root", base = file(".")).dependsOn(d)
works as it should.
Upvotes: 2