Overview
| Warning this paragraph is crap. |
The Groovy-Eclipse team is proud to announce the first milestone release of the Groovy-Eclipse plugin. In this release of the plugin, we have focused on ensuring that the basic edit-compile-run/debug loop works as smoothly as possible. So, you will see features like support for multiple projects, incremental compilation, and cross-language support. We have also put significant effort into making the plugin compatible with Eclipse's dynamic nature. We have worked hard to make sure that the Groovy model is updated as you type, so that early error detection works as you would expect and content assist will be able to pick up proposals from files that have not yet been saved.
Below is a short list of the new features now available.
Core
Cross language dependencies
Remove? Already available in alpha.
@Grab annotation
Generics
Remove? Already available in alpha.
Multi projects dependencies
Remove? Already available in alpha.
Incremental compilation
Remove? Already available in alpha.
AST transforms
Compiler level switching
The Groovy-Eclipse plugin M1 ships with both the 1.7-beta2 and 1.6.5 versions of the groovy compiler. Currently, the only way to switch between the two versions is outside of Eclipse. Here is how:
- Shut down Eclipse
- Go to eclipse/configuration/org.eclipse.equinox.simpleconfigurator
- Make a backup copy of bundles.info
- Open bundles.info in a text editor
- Find the line for org.codehaus.groovy_1.7.0 and delete
- Restart eclipse
To re-enable the 1.7 compiler, simply reinstate the backed up copy of bundles.info.
User Interface
Wizards
The wizards available mimic their Java counterparts.
New Groovy Project Wizard
The new Groovy project wizard allows you to create an Eclipse project pre-configured with Groovy support:
<img>
It supports all of the options available for Java projects:
<img>
New Groovy Class Wizard
This wizard creates a new Groovy class, with many of the same options available for the Java Class creation wizard:
<img>
New Groovy Test Case Wizard
This wizard assists you in creating a new Groovy JUnit 3 or JUnit 4 test case:
<img>
Convert Legacy projects
On startup, you are reminded to convert any legacy groovy projects in your workspace:
<img>
If you can decide to permanently dismiss this dialog box, you can still do the conversion from the preference pages:
<img>
Groovy Editor
As much as possible, we try to provide the same kind of behavior in the Groovy editor as you would expect in the Java editor. By default, the editor uses a different set of colors from the Java editor in order to emphasize the difference between the two languages. However, if you prefer standard Java syntax coloring, you can select it on the following preference page:
<img>
Additionally, the Groovy editor provides the following capabilities.
Early error indication
Errors are highlighted as you type. This functionality is provided by hooking into JDT's reconciling capability:
<img>
Content assist
Inferencing content assist has been available since earlier versions of the Groovy-Eclipse plugin. We are continuing to improve on this. For M1, we have focused on reliability and availability of content assist. For M2, we will focus on completeness of results. And for the final release, we will work on some performance tuning.
The following code snippet shows an example of the kinds of results that inferencing content assist provides:
<img>
Navigation
Typing F3, or CTRL-click (CMD-click on Macs) will navigate to the definition of a reference. Navigation hooks into the same inferencing engine being used for content assist. So, pressing F3 on the following:
<img>
will open an editor on the declaration:
<img>
Search
We have introduced type inferencing search in this milestone release. It is still in its basic stages and will be improved upon significantly for the next milestone. For example:
<img>
JUnit Monospace font
There is an option in the Groovy Preferences page to show the JUnit results pane in monospace font:
<img>
This is helpful for viewing the results of Spock tests:
Run/Debug
Launching
There are three launch options for your Groovy projects.
h7. Groovy Application
This is similar to launching Java applications. A main method of a Groovy or Java class is launched and you are provided with options similar to launching a standard Java application:
<img>
This launch configuration is likely to disappear in future versions because it no longer serves any purpose. All compiled Groovy scripts or Groovy classes with a main method can be run as Java Applications.
h7. Groovy Script
This launch configuration launches a *.groovy file as a script. It is identical to running the groovy command from the command line. This option allows you to use the @Grab annotation.
h7. Groovy Shell
This launch configuration allows you to run a groovy shell in the console view. When run from a particular project, all class files in the classpath of the project are available from the groovy prompt.
<img>
Note that there is a bug on windows where the groovy> prompt appears twice on each line. See GRECLIPSE-434.
Breakpoints and debugging
The Groovy-Eclipse plugin allows you to set breakpoints on any statement in a Groovy file, including inside closures:
<img>
When launched in debug mode as a Groovy Application or Groovy Script, execution will break when a breakpoint is reached:
<img>
Once a breakpoint is reached, (as in Java code) you can evaluate variables:
<img>
And evaluate code snippets from the display view (Java syntax required):
<img>
The Groovy debugging facility supports conditional breakpoints (Java syntax required):
<img>
Refactoring/Formatting
Indentation & Formatting
The Groovy editor will automatically indent poorly indented code on a paste. So, this:
Becomes this (note that triple quoted strings are not indented):
<img>
Quick suffix switching
It is simple to convert from a .java file to a .groovy file and back using the context menu:
<img>
Organize imports
The Groovy editor supports automatic organizing of imports (CTRL-Shift-O or CMD-Shift-O). Or you can set your project to automatically organize on save through the project properties page:
<img>
Issues addressed for M1
We have fixed over 130 issues for this milestone release: