Grails Development IDE Issues

GRRRR!! My IDE keeps crashing....

GRRRR!! My IDE keeps crashing....

After several months of ‘garage’ Groovy and Grails development I have recently spent some time on a commercial Grails based project. This blog aims to share some of the issues I have had with IDE support during this project. I will endeavor to update this entry in the future based on my experiences.

My IDE of choice has been Eclipse for a number of years, but during the project I found reason to switch to NetBeans . The cause for this radical IDE change was the Groovy Eclipse Plugin constantly crashing my Eclipse IDE!

The Groovy Eclipse Plugin does have 2 versions. In defense of the plugin, I switched to using version 2 when working on the project, and updated my Eclipse installation to the Galileo release. This version is an alpha, and I had not had any issues with version 1 in previous versions of Eclipse. The plugin home page does state that both versions are working with Eclipse 3.5. I am certain that I checked this before installing version 2. Although as an alpha release I do concede that some instabilities are to be expected. I had also updated to the 3.5.1 release when the crashes became too much for me!

In attempts to stop the constant IDE crashes I tried several JVM argument updates and even took the more radical step of using a totally different JVM. With each attempt proving futile I decided to browse the Groovy Eclipse Plugin JIRA issues for more specific information. Here I found issues related to the Eclipse installation (GRECLIPSE-409, GRECLIPSE-413) I have and the Groovy Eclipse Plugin version I am using. (GRECLIPSE-417).

GRRRRRRRRRRR!!!!! IDE Support..What IDE Support!

Nope..this one doesn't support it either!

On the recommendation of other team members I installed a version of Netbeans 6.7.1 which came with the Grails plugin installed. There are a quite a lot of things that I don’t like about the Netbeans IDE and the Grails plugin – but at the time of writing this blog entry – at least it is stable, doesn’t crash on me constantly and enables me to actually cut some code. Unfortunatly the Netbeans IDE is slow, the code completion is painfully slow (if it works at all), the Grails plugin hangs in the IDE and the interface is not as familiar to me (as Eclipse).

Thus, for the past week I have found myself using the a command line in a command window to build, run and test the Grails application – much as I did when using Eclipse during the ‘garage’ days. Stuck with an intolerably slow IDE with little to no code completion and frustrated by the whole development process. I am considering moving back to Eclipse and downgrading the Groovy Eclipse Plugin. (Any one got any suggestions/thoughs on that one?)

I throughly enjoy cutting Groovy/Grails code but would like a more productive IDE experience. I realize that a lot of IDE support is in alpha or beta status, but for Grails to gain some traction in the market place and with developers this support needs to exist.

I would love to hear about other peoples experiences with Grails IDE development. Information on plugins that I am unaware of or tips and tricks that would get me back up and running in Eclipse would be appreciated.

UPDATE – 10/01/2009

Almost a week has passed and there have been numerous comments on this blog entry, so I thought I would update it with my current status. I have removed all Eclipse instance from my working machine since the initial writing. These instances have been replaced by the Spring Source Tools (STS) 2.1.0 as recommended in the initial comment on this entry.

I have had several issues with this version – it seems to crash once I install the Subclipse plug-in as per versions of Eclipse 3.5.1. I had to reinstall the STS a few times during the week, but at times it has been stable and quite usable. As it still crashes I don’t consider this to be the end of my quest – so will be reviewing the comments that have been made and acting on them this week. I shall update when I have more information.

Eclipse Tip #1 – Static Import Code Completion

If like me Eclipse is your IDE of choice and you find yourself frustrated by having to add an import statement in order to use common static imports then help is at hand. If you use JUnit 4′s assertThat method, the core Hamcrest matchers or even EasyMock verifiers etc, then this tip will make your life easier.

In order to simplify using these static methods add them to your Eclipse static import favourites. This little gem of functionality is found under Preferences -> Java -> Editor -> Content Assist -> Favorites.

Eclipse Static Import Favouries

Eclipse Static Import Favouries

In the above example I have added the org.junit.Assert.* package to my favourites. Now when I am working on some java code and want to use a static import from this package it will be available in the code completion box, as can be seen below.

Code Completion Static Imports in Eclipse

Code Completion Static Imports in Eclipse

Acknowledgment for this simple tip and a few more must go to Benjamin Winterberg who provided this in his 5 Tips for Customizing Eclipse blog entry. Vote his entry up on DZone by voting here.  Hopefully this tip will make your Eclipse static import use a pleasure and not a frustration from now on.