为什么在IntelliJ中运行Scala 2.13测试而不是在Scala 2.12中运行时出现此错误? [英] Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?

查看:510
本文介绍了为什么在IntelliJ中运行Scala 2.13测试而不是在Scala 2.12中运行时出现此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在带有Scala 2.13的IntelliJ(2019.1),Scala IntelliJ插件v2019.1.8中运行测试时遇到以下错误:

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)

以下是我的Gradle依赖项:

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

当我将依存关系更改为Scala 2.12.x时,测试将在IntelliJ中正确执行而没有错误.这是怎么回事?

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

推荐答案

更新:这已已修复在插件版本2019.1.9中.

Update: This has been fixed in plugin version 2019.1.9.

可能需要为2.13更新IntelliJ Scala插件.同时,尝试通过选择测试Use sbt和Use UI with sbt来尝试解决方法="noreferrer"> Edit configuration... .根据 Dmitrii Naumenko :

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每晚
  • 将于2019.2 EAP和2019.1新发行版中很快推出
  • 2019.1 EAP #2019.1.8.21
  • 2019.2 Nightly
  • Will be available soon in 2019.2 EAP and 2019.1 new Release

关于Gradle,请尝试配置为委派给 Gradle测试运行器

Regarding Gradle, try configuring to delegate to Gradle Test Runner

  1. 删除现有的ScalaTest运行程序
  2. 转到Build, Execution, Deployment | Build Tools | Gradle | Runner
  3. 选中复选框Delegate IDE build/run actions to Gradle
  4. 选择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

这篇关于为什么在IntelliJ中运行Scala 2.13测试而不是在Scala 2.12中运行时出现此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆