Scala 2.13.1-错误:错误符号';键入org.scalatest.WordSpec';类路径中缺少
我有一个非常简单的sbt项目 [build.sbt]Scala 2.13.1-错误:错误符号';键入org.scalatest.WordSpec';类路径中缺少,scala,playframework,scalatest,Scala,Playframework,Scalatest,我有一个非常简单的sbt项目 [build.sbt] name := "some" version := "0.1" scalaVersion := "2.13.1" libraryDependencies ++= Seq( "org.scalatest" %% "scalatest-mustmatchers" % "3.2.0-M1" % Test, "org.scalatestplus.play" %% "scalatestplus-play" %
name := "some"
version := "0.1"
scalaVersion := "2.13.1"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest-mustmatchers" % "3.2.0-M1" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % "test",
"org.scalatestplus" %% "scalatestplus-mockito" % "1.0.0-M2" % Test
)
sbt.version = 1.3.7
import org.scalatestplus.play.PlaySpec
class PersonSpec extends PlaySpec {
}
[build.properties]
name := "some"
version := "0.1"
scalaVersion := "2.13.1"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest-mustmatchers" % "3.2.0-M1" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % "test",
"org.scalatestplus" %% "scalatestplus-mockito" % "1.0.0-M2" % Test
)
sbt.version = 1.3.7
import org.scalatestplus.play.PlaySpec
class PersonSpec extends PlaySpec {
}
[src/test/scala/PersonSpec.scala]
name := "some"
version := "0.1"
scalaVersion := "2.13.1"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest-mustmatchers" % "3.2.0-M1" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % "test",
"org.scalatestplus" %% "scalatestplus-mockito" % "1.0.0-M2" % Test
)
sbt.version = 1.3.7
import org.scalatestplus.play.PlaySpec
class PersonSpec extends PlaySpec {
}
当我在sbt中运行test
时,我得到了以下错误:
[info] Compiling 1 Scala source to /Users/.../target/scala-2.13/test-classes ...
[error] /Users/.../src/test/scala/PersonSpec.scala:4:26: Symbol 'type org.scalatest.WordSpec' is missing from the classpath.
[error] This symbol is required by 'class org.scalatestplus.play.PlaySpec'.
[error] Make sure that type WordSpec is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'PlaySpec.class' was compiled against an incompatible version of org.scalatest.
[error] class PersonSpec extends PlaySpec {
[error] ^
[error] one error found
[error] (Test / compileIncremental) Compilation failed
[error] Total time: 5 s, completed Feb 4, 2020 11:50:27 AM
如何修复此错误?似乎是二进制兼容性问题。我认为
scalatestplus play
是根据以前版本的scalatestplus mockito
编译的,而这个1.0.0-M2
版本与那个版本不保持二进制兼容性。谢谢Sarvesh,我要检查一下。