Copasetic Groovy Eclipse plug-in fix

The latest version of the Groovy plug-in for Eclipse is broken in CVS. It doesn’t compile and once it does, you can’t make GroovyTestCases or normal JUnit tests either.

If you want to be groovy with Groovy in Eclipse, you’ll need to follow the instructions on the Groovy site and do the following additional trippn’ tasks:

  1. In the class org.codehaus.groovy.eclipse.editor.GroovyConfiguration delete the org.codehaus.groovy.eclipse.editor.GroovySourceViewerConfiguration.Hover import.
  2. In the class org.codehaus.groovy.eclipse.model.GroovyProject fix the method isTestCaseClass to use the getSuperClassNode() method instead of the getSuperClass() one, like this:
    private boolean isTestCaseClass(ClassNode classNode) {
      ClassNode parent = classNode.getSuperClassNode();
      while (parent != null) {
       if (parent.getNameWithoutPackage().equals("TestCase")) {
        return true;
       }
       parent = parent.getSuperClassNode();
      }
      return false;
    }
    
  3. Edit the plugin.xml file to include <import plugin="org.junit"/> in the <requires> section.

Export the plug-in and you should be good to go disco dancing (or at least Groovy programmin’).

Related odds and ends
 

2 Responses to “Copasetic Groovy Eclipse plug-in fix”

  1. on 23 Feb 2006 at 5:48 pm Kyle Dyer

    I’m down man. Thanks for the post. I tried to work through this a few weeks back but didn’t pick up on missing import in the plugin.xml.

    However…

    Isn’t Groovy a waste of time? I’ve read a few scathing blog posts about the progress of Groovy development. Is the fact that it is a JSR enough to expect that the language will survive and be useful in the long term? I’d love to get into using “dynamic languages” for testing. But I’m unsure which one to use? Do you have any opinions about Jython as a language for rapid test development?

  2. on 23 Feb 2006 at 6:52 pm Andy

    Groovy is still young- it got a lot of press too early it seems. Jython, Python, and Ruby have been around for years and have had plenty of time to mature.

    Jython is a fun language to develop in. It’s Python based, so the learning curve is slightly steeper than that of Groovy. Check out the PyDev Eclipse plug-in- this is how the Groovy one should act someday. I suspect you’ll see more tool development for Groovy once the language itself matures.

Trackback this Post | Feed on comments to this Post

Leave a Reply