Groovy

Using Groovy

Language Guide

Groovy Features

Modules

Examples

Useful Links

IDE Support

Support

Community

Developers

Tools we use

IntelliJ IDEA
YourKit profiler

Feeds


Site
News
Eclipse Plugin

So, the shell not enough? Fancy a bit of IDE action?
Well you're in the right place.
If you have landed here and want to find out what is Groovy first, check http://groovy.codehaus.org.

Here you will find the latest information regarding the groovy Eclipse plug-in, some step-by-step instructions to build or download, install and test …


Check also : Hacking the Eclipse plug-in for some status info and current issues and bugs

 These instructions have been written based on Eclipse 3.0.1. For 3.1, you may need to do slight adjustments...

First check the plug-in's Eclipse Version compatibility:

Please edit this page and report the version you are using successfully if not listed!


The plug-in has been reported to work with:

  • Eclipse 3.0 : the latest plug-in binary DOES NOT WORK with 3.0. 3.0 has quite a few serious bugs anyway, which are corrected in 3.0.1. Groovy or not, you will be better off with version 3.0.1 of Eclipse!
  • Eclipse 3.0.1
  • Eclipse 3.1 M1 (but it has been reported that java code in the same project's source folder, or other referenced project's code does not seem to be visible)

For 3.0.1, and 3.1 M1, external libraries are only supported as classpath entries. You will need to update your project dependencies (Project Properties/Java Build Path/Libraries) with any referenced libraries.

Now let's do some work:

Download the latest available binary plug-in...

  • latest build: 2004-09-23 off CVS.
    I tested that build with Eclipse 3.0.1 and it worked almost perfectly.
  • Download at : http://sf.net/projects/nexb

… or build the latest version from CVS, if you are courageous ...

  1. Check out /groovy/ide/groovy-eclipse/Groovy and /groovy/ide/groovy-eclipse/GroovyEclipse from CVS (see here http://groovy.codehaus.org/cvs-usage.html for CVS info) into separate Eclipse projects. Just use simple check-outs, CVS already contains all the information Eclipse needs to create the projects properly (i.e. .project and .classpath and other files)
  1. As of 2004-09-30, there are still a few quirks in the code base: You will need to perform the following minor adjustment.
    • comment one weird line of code in org.codehaus.groovy.eclipse.model.AddErrorMarker.java (line 81) which says :
      unit.
  2. Select the GroovyEclipse project in the package explorer view, right mouse click, select Export and a pop-up window called Export shows up.
  3. In the Export pop-up, select "Deployable plug-ins and fragments", click Next, then:
    • In the Available Plug-ins and Fragments list, select "org.codehaus.groovy", "org.codehaus.groovy.eclipse"
    • In Export Options/Deploy as, Select "as single Zip file"
    • In the Destination, enter or browse for a file name
    • Click on Finish, and you are done.

… then Install and Test

The zip file you just created (or downloaded) is now just like any other plug-in zip file, that can be unzipped under the eclipse root directory.


To install and test the plug-in:

  1. Open the zip file and extract its content to the eclipse root directory.
    You can check that two folders have been created under eclipse/plugin:
    org.codehaus.groovy.eclipse_1.0.0 and org.codehaus.groovy_1.0.0
  2. Restart Eclipse to install the Groovy plug-in
  3. For quick test of the plug-in:
    • Create a new Java project, right mouse-click on the src folder, and select New/Other/Groovy/Groovy Class
    • Create a new Groovy class called GTest,
    • or alternatively create a new plain file and give it the name of the class you want to create plus the .groovy extension
    • When prompted "Add runtime groovy support and auto-build to project?" , click Yes! (You may be prompted that question twice… always say Yes!)
    • You can paste the following snippet into the GTest.groovy editor:
      GTest.groovy
      class GTest{
        static void main(args) {
         list = ["Rod", "Phil", "James", "Chris"]
         shorts = list.findAll { it.size() < 5 }
         shorts.each { println it }
         }
      }

    • In the Project Explorer, select GTest.groovy, then right mouse-click and Run/Run
    • In the Run pop-up, select Groovy in the list of configurations, then click New, and click the Search button to search for the Main Class.
      The GTest class should appear in the list of Groovy classes to run. Select it and click OK.
    • Click Apply, then Run… check your console view, it should read Rod, Phil...

YOU ARE REALLY DONE!    


For more code examples to play with, you can check also the Groovy Home page, or check some recent fine articles published here and there:


Some known problesm...

  • When you create a new run configuration, it doesn't automatically find the class that you select in the package explorer or navigator. You have to enter the name of thte class manually, or select browse.