Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?

陌路散爱 提交于 2019-12-18 18:55:12

问题


I am getting the following error when I try to run tests in IntelliJ (2019.1), Scala IntelliJ plugin v2019.1.8, with Scala 2.13:

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)

The following are my Gradle dependencies:

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'
}

When I change the dependencies to Scala 2.12.x, the tests execute correctly in IntelliJ without error. What is going on here?


回答1:


Update: This has been fixed in plugin version 2019.1.9.


It is possible IntelliJ Scala plugin needs to be updated for 2.13. Meanwhile try workaround by selecting the checkboxes Use sbt and Use UI with sbt under test's Edit configuration.... According to Dmitrii Naumenko:

This is fixed in the

  • 2019.1 EAP #2019.1.8.21
  • 2019.2 Nightly
  • Will be available soon in 2019.2 EAP and 2019.1 new Release

Regarding Gradle, try configuring to delegate to Gradle Test Runner

  1. Remove exising ScalaTest runners
  2. Go to Build, Execution, Deployment | Build Tools | Gradle | Runner
  3. Select the checkbox Delegate IDE build/run actions to Gradle
  4. Choose Gradle Test Runner


来源:https://stackoverflow.com/questions/56645239/why-am-i-getting-this-error-when-running-scala-2-13-tests-in-intellij-but-not-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!