Friday, March 04, 2011

Griffon Eclipse Integration

I spend a better part of a day searching around to figure out how to get Griffon and Eclipse to play nice together. I figured I will write it up to help the next person.

First you need to install the Groovy-Eclipse plugin. Here is the step by step guide to installing Groovy-Eclipse plugin:
http://docs.codehaus.org/display/GROOVY/Install+Groovy-Eclipse+Plugin

After you installed the plugin, follow the following steps to add eclipse support to your Griffon project.

Create a new Griffon project:
> griffon create-app eclipse-integration

Add the Eclipse integration
> cd eclipse-integration
> griffon --integrate-with --eclipse

Install the Eclipse plugin to your Griffon project
> griffon install-plugin eclipse-support

If you need a specific version of the eclipse-support then you can specify it at the end. Since I am using Griffon 0.9.1a, I need to use version 0.3.1 of the eclipse support plugin.
> griffon install-plugin eclipse-support 0.3.1

Now you need to update the .classpath file in the project
> griffon eclipse-update

Now it is time to import the project into Eclipse. Go to Eclipse and select File -> Import.
Select General -> Existing Projects into Workspace
Press Next
Select the root directory of the Griffon project and click Finish.
You are almost there. If you select run right now, it will complain about GRIFFON_HOME is not set.
Right click on your project.
Select Run As then Run Configuration.
Expand Java Application.
You should find eclipse-integration under Java Application if you follow along with instruction or it will be whatever you name your project.
Select eclipse-integration.
Select the tab Environment on the right.
Click the New button
For name type in GRIFFON_HOME.
For value type in the path to Griffon.
Click Ok.
Click Apply.
Click Run.

Gotcha:
I find that when I am editing a view, I can't click Run to run the project. I have to click on the project then click run to run it. Editing the controller and model do not have this problem.