Scala 从“运行测试时”;sbt测试“;类路径与从IDEA运行时不同
我有以下简单的测试:Scala 从“运行测试时”;sbt测试“;类路径与从IDEA运行时不同,scala,sbt,classpath,scalatest,Scala,Sbt,Classpath,Scalatest,我有以下简单的测试: class ClasspathTest extends FlatSpec with Matchers { "The classpath" should "have more than one member" in { System.getProperty("java.class.path").split(":").length should be > 1 } } 这驻留在一个sbt项目中。从IDEA运行此测试时,此测试成功,因为它包含我在build
class ClasspathTest extends FlatSpec with Matchers {
"The classpath" should "have more than one member" in {
System.getProperty("java.class.path").split(":").length should be > 1
}
}
这驻留在一个sbt项目中。从IDEA运行此测试时,此测试成功,因为它包含我在build.sbt
中指定的所有libraryDependencies
但是,当执行sbt测试时
失败,因为它只包含/opt/sbt/bin/sbt launch.jar
现在我有一个测试,它依赖于这个运行时类路径是否被完全填充
是否可以以某种方式填充它?这是的副本
要使其正常工作,我必须在build.sbt中包括:
fork in Test := true