2015-03-19 165 views
11

导入Maven项目到Eclipse月神修改方法后,保存时显示在弹出下面的错误后:错误:无法初始化模块TreeWalker - 无法实例JUnitTestCase

cannot initialize module TreeWalker - Unable to instantiate JUnitTestCase

JUnitTestCase指的是在CheckStyle的xml文件的模块:

<module name="JUnitTestCase"/> 

我有“对m2eclipse的的Checkstyle配置插件”和“的Checkstyle插件6.4.0”安装。我的pom文件中'maven-checkstyle-plugin'的插件定义指定了版本2.10。

注意:我意识到这是类似的一些其他问题具有相同的错误(但不同的模块指定),但我还没有找到一个令人满意的解决方案。我相信我可以删除checkstyle配置文件中的模块条目,但我要求它按照设计工作,所以这不是更好的选择。

回答

13

JUnitTestCase是removed in Checkstyle 6.2(请参阅“打破向后兼容性”)。因此,您应该降级到Checkstyle 6.1.1,或从checkstyle.xml中删除模块引用。

+0

了解!我想降级会是。 – Continuity8 2015-03-19 21:05:04

+0

如何在Eclipse中降级它? – Marco 2015-08-17 11:06:40

+0

@Marco这应该是一个单独的问题,但答案是您通过安装[Eclipse-CS 6.1.1]来降级(http://sourceforge.net/projects/eclipse-cs/files/Eclipse%20Checkstyle%20Plug-在/ 6.1.1 /)。 – 2015-08-17 16:19:11