通过Intellij运行scalatest时,我不断收到以下异常。当我通过gradle在命令行中运行它时,会发生相同的错误。到目前为止,我无济于事地尝试了以下操作:
我想知道是否有人遇到类似的错误或知道什么可能是错的?
java.lang.NoClassDefFoundError: scala/Product$class
at org.scalatest.time.Days$.<init>(Units.scala:291)
at org.scalatest.time.Days$.<clinit>(Units.scala)
at org.scalatest.time.Span$.<init>(Span.scala:585)
at org.scalatest.time.Span$.<clinit>(Span.scala)
at org.scalatest.tools.Runner$.<init>(Runner.scala:779)
at org.scalatest.tools.Runner$.<clinit>(Runner.scala)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
Caused by: java.lang.ClassNotFoundException: scala.Product$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
完整的依赖项列表:
compile('org.scala-lang:scala-library:2.11.6') { transitive = true }
compile('org.scalatest:scalatest_2.11:2.2.4') { transitive = true }
compile 'org.scala-lang.modules:scala-xml_2.11:1.0.3'
compile 'xml-apis:xml-apis:1.4.01'
compile 'junit:junit:4.11'
compile 'org.pegdown:pegdown:1.1.0'
compile 'net.liftweb:lift-json_2.12:3.3.0'
答案 0 :(得分:0)
找到了罪魁祸首。这是由以下软件包引起的。 我将尝试其他版本。
编译'net.liftweb:lift-json_2.12:3.3.0'