测试SBT期间Classpath中的测试jar

时间:2015-01-18 16:07:33

标签: scala sbt

我们在两个单独的罐子里有一个Stub类和实时类的disptach-reboot。我们在SBT中需要一种方法,以便在运行单元测试时需要类路径中的Stub类,而在生产中运行代码时需要Real类。

1 个答案:

答案 0 :(得分:0)

使用multi-project .sbt build definitionunmanaged 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: _*)