Wednesday, March 26, 2008

First experience with Groovy and Grails support in NetBeans 6.1



Recently many blog postings related to NetBeans with Groovy and Grails integration appeared on groovyblogs.org. See Guillaume Laforge's Groovy / Grails support in NetBeans and GlassFish blog entry for a complete summary and links to related postings.

When I was reading those posting I felt it was time to try it out myself.
After downloading the latest NetBeans 6.1 nightly build and installing the Groovy and Grails plugin, I was ready for a testdrive.

Creating a Grails project


Creating a Grails project has never been easier. The NetBeans 6.1 Groovy and Grails plugin contains a New Project wizard for creating a new Grails project.



After creating the project (NetBeans is calling the Grails create-app command underwater), NetBeans displays a nice project structure specially for Grails projects.



See how NetBeans nicely devides all Grails artifact types (like Controllers, Domain classes, Scripts, Services, etc.) in separate folders.

Creating Grails artifacts


The NetBeans 6.1 Groovy and Grails plugin features context menus for creating Grails artifacts like Domain classes etc easily. After clicking the context menu item, a dialog is opened to enter information needed to create the Grails artifact.





After creating the domain class a context menu is available for generating the controller and views.



NetBeans is always calling the Grails commands underwater and this means that when generating the Views from within NetBeans also customized templates can be used. As far as I could find the install-templates command could not be executed from within NetBeans, so you still need the Grails command line.

Code-completion and syntax color highlighting


The NetBeans 6.1 Groovy and Grails plugin offers Groovy code completion and syntax color highlighting. To bad the current version does not yet include code-completion for Grails dynamic methods.



Running a Grails application


From within NetBeans the Grails application can be started (run-app) using a context menu on application level.



Notice also the context menu item to generate a war archive or to see statistics.

Deploying a Grails application to GlassFish


Reading the other blog posting it is also possible to deploy your Grails application in GlassFish, but I didn't tested this myself yet.

Summary


My first experience with the NetBeans 6.1 Groovy and Grails plugin is good. Nice to have those context menu for executing the Grails commands from the IDE. However code completion, and specially for Grails dynamic methods, need to improve to really compete with IntelliJ. But I really believe this will happen in the near future!

2 comments:

zack said...

Thanks for sharing your exploration into the NetBeans world!

Greetings, Niko

Anonymous said...

Very good!