当我尝试在带有Scala 2.13的IntelliJ(2019.1),Scala IntelliJ插件v2019.1.8中运行测试时遇到以下错误:
Exception in thread "ScalaTest-dispatcher" java.lang.NoSuchMethodError: scala.collection.JavaConverters.seqAsJavaListConverter(Lscala/collection/Seq;)Lscala/collection/convert/Decorators$AsJava;
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.getOrdinalList(ParallelTreeBuilder.java:21)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder$SuiteTree.<init>(ParallelTreeBuilder.java:92)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.initRun(ParallelTreeBuilder.java:261)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestReporterWithLocation.apply(ScalaTestReporterWithLocation.java:59)
at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10(DispatchReporter.scala:249)
at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10$adapted(DispatchReporter.scala:248)
at scala.collection.immutable.List.foreach(List.scala:312)
at org.scalatest.DispatchReporter$Propagator.run(DispatchReporter.scala:248)
at java.lang.Thread.run(Thread.java:745)
以下是我的Gradle依赖项:
dependencies {
implementation 'org.scala-lang:scala-library:2.13.0'
testImplementation 'org.scalatic:scalatic_2.13:3.0.8'
testImplementation 'org.scalatest:scalatest_2.13:3.0.8'
}
当我将依存关系更改为Scala 2.12.x时,测试将在IntelliJ中正确执行而没有错误。这是怎么回事?
答案 0 :(得分:9)
更新:插件版本2019.1.9中的fixed。
可能需要为2.13更新IntelliJ Scala插件。同时,尝试通过选择被测Edit configuration...
下的复选框Use sbt
和Use UI with sbt
来解决问题。根据{{3}}:
此问题已在
中修复
- 2019.1 EAP#2019.1.8.21
- 2019.2每晚
- 将在2019.2 EAP和2019.1新版本中很快推出
关于Gradle,请尝试配置为委派给Dmitrii Naumenko
Build, Execution, Deployment | Build Tools | Gradle | Runner
Delegate IDE build/run actions to Gradle
Gradle Test Runner