zoukankan      html  css  js  c++  java
  • IDEA里运行代码时出现Error:scalac: error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class错误的解决办法(图文详解)

       不多说,直接上干货!

      

     问题详情

      当出现这类错误时是由于版本不匹配造成的

    Information:2017/8/29 7:54 - Compilation completed with 10 errors and 0 warnings in 3s 910ms
    Error:scalac: error while loading JUnit4, Scala signature JUnit4 has wrong version
     expected: 5.0
     found: 4.1 in JUnit4.class
    Error:scalac: error while loading ConsoleRunner, Scala signature ConsoleRunner has wrong version
     expected: 5.0
     found: 4.1 in ConsoleRunner.class
    Error:scalac: error while loading Specification, Scala signature Specification has wrong version
     expected: 5.0
     found: 4.1 in Specification.class
    D:CodeIntelliJIDEACodeHadoopSparkMllibActionsrc	estscalazhoulsigdataMySpec.scala
    Error:(6, 26) illegal inheritance;
     self-type zhouls.bigdata.MySpecTest does not conform to org.specs.runner.JUnit4's selftype org.specs.runner.JUnit4
    class MySpecTest extends JUnit4(MySpec)
                             ^
    Error:(6, 18) org.specs.runner.JUnit4 does not have a constructor
    class MySpecTest extends JUnit4(MySpec)
                     ^
    Error:(8, 29) illegal inheritance;
     self-type zhouls.bigdata.MySpecRunner.type does not conform to org.specs.runner.ConsoleRunner's selftype org.specs.runner.ConsoleRunner
    object MySpecRunner extends ConsoleRunner(MySpec)
                                ^
    Error:(8, 21) org.specs.runner.ConsoleRunner does not have a constructor
    object MySpecRunner extends ConsoleRunner(MySpec)
                        ^
    Error:(10, 23) illegal inheritance;
     self-type zhouls.bigdata.MySpec.type does not conform to org.specs.Specification's selftype org.specs.Specification
    object MySpec extends Specification {
                          ^
    Error:(10, 15) org.specs.Specification does not have a constructor
    object MySpec extends Specification {
                  ^
    Error:(11, 27) value should is not a member of String
      "This wonderful system" should {
                              ^

    解决办法

      如果你想快速运行的话,就用idea建立的maven项目生成的几个test类和对象注释掉,或者删除掉即可运行。

     

       然后,运行即可。

      当然,上面的这种方法不是最彻底的。

       File  -> settings ->  Editor -> plugins -> junit

     

  • 相关阅读:
    pch”预编译头文件来自编译器的其他版本,或者预编译头为 C++ 而在 C 中使用它(或相反) and vs找不到路径
    VC++获得当前系统时间的几种方案
    无法解析的外部符号 __imp____glutInitWithExit@12,该符号在函数 _glutInit_ATEXIT_HACK@8 中被引用
    error C2381: “exit” : 重定义
    vs2019 link glaux.lib 无法解析的外部符号,是缺少一个Lib
    操作系统算法整理+汇总
    vs2019配置glm包
    第二题 既约分数
    死磕Spring之IoC篇
    精尽Spring Boot源码分析
  • 原文地址:https://www.cnblogs.com/zlslch/p/7446548.html
Copyright © 2011-2022 走看看