我们在两个单独的罐子里有一个Stub类和实时类的disptach-reboot。我们在SBT中需要一种方法,以便在运行单元测试时需要类路径中的Stub类,而在生产中运行代码时需要Real类。
答案 0 :(得分:0)
使用multi-project .sbt build definition和unmanaged dependencies:
lazy val commonSettings = Seq(
dependencyClasspath in Compile += baseDirectory.value / "lib-main" / "realclasses.jar",
dependencyClasspath in Runtime += baseDirectory.value / "lib-main" / "realclasses.jar",
dependencyClasspath in Test += baseDirectory.value / "lib-test" / "stubclasses.jar"
)
lazy val root = (project in file(".")).settings(commonSettings: _*)