我对SBT子项目有一个奇怪的问题,我认为这是与依赖相关的。这是我的设置:
MyA
MyB
。当我尝试从SBT提示符执行MyB
时,我在NoSuchMethodError
上获得了MyA
。这不是ClassNotFoundException
,但也许它正在发生,因为它在类路径上看到MyA
类,而不是MyA
对象。
作为一个完整性检查,我删除了B子项目并将其源代码移动到A源代码树中。当我从SBT提示符运行MyB
时,它按预期工作。
有没有人碰到这个,或者我做了明显错误的事情?
这是我的项目配置:
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)
}
答案 0 :(得分:2)
事实证明,在项目B上启用continuation插件时遇到了问题。这是我的工作配置:
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) with AutoCompilerPlugins {
override def compileOptions = super.compileOptions ++ compileOptions("-P:continuations:enable") ++ compileOptions("-unchecked")
}
}