Note that there are some explanatory texts on larger screens.

plurals
  1. POSubproject dependencies in SBT
    primarykey
    data
    text
    <p>I am having a strange problem with SBT subprojects which I think is dependency related. Here's my setup:</p> <ul> <li>I have an SBT project with two subprojects A and B.</li> <li>A contains a class and companion object <code>MyA</code></li> <li>B depends on A.</li> <li>B contains an object <code>MyB</code> which has a main method.</li> </ul> <p>When I try to execute <code>MyB</code> from the SBT prompt, I get a <code>NoSuchMethodError</code> on <code>MyA</code>. This is not a <code>ClassNotFoundException</code>, but maybe it's happening because it sees the <code>MyA</code> class on the classpath, but not the <code>MyA</code> object.</p> <p>As a sanity check, I dropped the B subproject and moved its source into the A source tree. When I run <code>MyB</code> from the SBT prompt, it works as expected.</p> <p>Has anyone run into this, or am I doing something obviously wrong?</p> <p>Here is my project configuration:</p> <pre><code>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) } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload