Where have I gone wrong with this SBT project configuration?
I have a parent project A, with subprojects B1 and B2, and B2 depends on project B1.
B1 compiles successfully; but B2’s compilation fails because it cannot find B1’s classes.
import sbt._
class A(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
lazy val B1 = project("b1", "B1", new B1(_))
lazy val B2 = project("b2", "B2", new B2(_))
class B1(info: ProjectInfo) extends DefaultWebProject(info) with IdeaProject {
override def unmanagedClasspath = super.unmanagedClasspath +++ extraJars
def baseDirectory = "lib"
def extraJars = descendents(baseDirectory, "*.jar")
}
class B2(info: ProjectInfo) extends DefaultProject(info) with IdeaProject {
override def deliverProjectDependencies =
B1.projectID :: super.deliverProjectDependencies.toList
}
}
I’m really not sure if I’ve defined the dependency between B2 and B1 correctly. I would have specified it using the project method with this signature:
def project(path: Path, name: String, deps: Project*): Project
… but I need the subprojects to mix in the IdeaProject trait.
Well, you’re using the other signature, though:
So, you need B2 to declare a dependency on B1.
Note: I’m pretty sure I’d rename the variables to not be the same as the class name here, because that just confuses me, and while it should work, that just seems funky.