IDEA里运行代码时出现Error:scalac: error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class错误的解决办法(图文详解)-阿里云开发者社区

开发者社区> 开发与运维> 正文
登录阅读全文

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:\Code\IntelliJIDEACode\HadoopSparkMllibAction\src\test\scala\zhouls\bigdata\MySpec.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

 

 


本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/7446548.html,如需转载请自行联系原作者




版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享: