12
votes

After importing a maven project to Eclipse Luna the following error is displayed in a pop-up when saving after modifying a method:

cannot initialize module TreeWalker - Unable to instantiate JUnitTestCase

JUnitTestCase is referring to a module in the checkstyle xml file:

<module name="JUnitTestCase"/>

I have the 'Checkstyle configuration plugin for M2Eclipse' and 'Checkstyle Plug-in 6.4.0' installed. The plugin definition for 'maven-checkstyle-plugin' in my pom file specifies version 2.10.

Note: I realise this is similar to some other questions with the same error (but a different module specified) however I am yet to find a satisfying solution. I believe that I could remove the module entry in the checkstyle config file but I require it to work as designed so that is not the preferable option.

1

1 Answers

14
votes

JUnitTestCase was removed in Checkstyle 6.2 (look under "Breaking backward compatibility"). So you should either downgrade to Checkstyle 6.1.1, or remove the module reference from your checkstyle.xml.