Grinding Griffon: The Setup

Griffon is the rapid desktop development equivalent to Grails or Ruby on Rails. Griffon is a desktop application framework written in Groovy, a scripting language that runs on the Java Virtual Machine. Just like Grails or Rails, Griffon is very DRY and opinionated, comes with generators, and separates your models from your controllers from your views.

To install Griffon just follow their instructions. Installing Griffon is very simple, basically just unzip the download, create a GRIFFON_HOME environment variable, and add the Griffon bin to your path. Once you have Giffon in your path, you can just type griffon from the command prompt and you should get some output much like this.

Welcome to Griffon 0.1.1 - http://griffon.codehaus.org/
Licensed under Apache Standard License 2.0
Griffon home is set to: /OSDEV/griffon-0.1.1

No script name specified. Use 'griffon help' for more info or 'griffon interactive' to enter interactive mode

To create a new Griffon project, execute the following command from the command line.

giffon crate-app

You will be asked to enter a application name. You will be asked to enter a MVC Group name too. The name given for the MVC Group will be used to create a Griffon model, view, controller, and test.

Creating a new Griffon application creates a directory structure not to dissimilar from those created for a Grails or Rails project. In the case of Griffon, your application’s root directory will have a griffon-app directory, under which you have a controllers, models, and views directory.

New Griffon Project

New Griffon Project

Even though we have not added any of our own code, the Griffon application just created is fully functional and can be started. To run the application execute the following from the command line.

griffon run-app

If you named your application different that your default MVC group, you will get an error running the app. To start up correctly, Griffon needs a MVC group to run and by default the MVC group name is that of the application, but this can be different if you enter a different name for the MVC Group. Whatever the case might be, you can edit Application.groovy under griffon-app\conf directory to startup the correct MVC group.

If everything is setup correctly, you should get a small window that reads ‘Content Goes Here!’ when you run the Griffon application. To modify the desktop application, edit the view file for your default MVC group which is located under the griffon-app\views directory.

NetBeans has decent support for Groovy, and just about every other programming langauge. There is a Griffon plugin for Netbeans 6.7. Unfortunately as of this writing, I was not able use the Grifon plugin to crate a new Griffon project… But once you have Griffon project, you can open the project and edit the Groovy views, controllers, and models in NetBeans.