I had a strange problem with SBT subprojects which I think are related to dependency. Here is my setup:
- I have an SBT project with two subprojects A and B.
- A contains the class and companion object
MyA - B depends on A.
- B contains the
MyB object, which has the main method.
When I try to execute MyB from the SBT prompt, I get a NoSuchMethodError on MyA . This is not a ClassNotFoundException , but perhaps this is because it sees the class MyA in the classpath, but not in the MyA object.
As a health check, I dropped subproject B and moved its source to the source tree. When I start MyB from the SBT prompt, it works as expected.
Has anyone come across this, or am I doing something obviously wrong?
Here is my project configuration:
class MyProject(info: ProjectInfo) extends ParentProject(info) { lazy val a = project("a", "a", new AProject(_)) lazy val b = project("b", "b", new BProject(_), a) object Dependencies { lazy val scalaTest = "org.scalatest" % "scalatest_2.9.0" % "1.4.1" % "test" } class AProject(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins { val scalaTest = Dependencies.scalaTest val continuationsPlugin = compilerPlugin("org.scala-lang.plugins" % "continuations" % "2.9.0") override def compileOptions = super.compileOptions ++ compileOptions("-P:continuations:enable") ++ compileOptions("-unchecked") } class BProject(info: ProjectInfo) extends DefaultProject(info) }
source share