Grails development made even simpler using NetBeans IDE 6.5
After having read the book Beginning Groovy and Grails: From Novice to Professional, I was wondering if it was ever going to be as simple as a few clicks in any IDE for Grails development. Just yesterday, I read an article by Geertjan Wielenga(who is also my colleague at Javalobby/DZone) about how to get started with Grails in NetBeans IDE 6.5 in 5 simple steps. I had worked with NetBeans quite a lot for EJB3 development but I had never used it for either Groovy or Grails; the choice earlier was always Eclipse IDE.
I first followed the Book Demo and later moved to a more real life example. This was a litmus test which I thought NetBeans had to pass for developers to continue using the same for Groovy/Grails development. The example in the book has a few relationships; which is what we would generally have in any enterprise application.

I was able to create all the domain classes, controllers, manage relationships without ever leaving the IDE. Creating a Domain class or even a Controller, is as simple as right clicking on the appropriate nodes and providing meaningful names. The IDE creates the skeleton classes; we need to provide the meat within and here is what the Todo Domain class looks like:
class Todo {
String name
String note
Date createdDate
Date dueDate
Date completedDate
String priority
String status
User owner
Category category
static belongsTo = [User, Category]
static constraints = {
name(blank:false)
createdDate()
priority()
status()
note(maxSize:1000, nullable:true)
completedDate(nullable:true)
dueDate(nullable:true)
}
String toString() {
name
}
}
Right-click the application in the IDE and choose “Run”. The application is deployed to Jetty, and then you’ll see your application as shown below:

If you are a Groovy or a Grails fan, download the latest version of NetBeans and give it a try. You can develop, test and run your Grails application without ever opening a command window. The Groovy editor has basic coloring, formatting and bracket completion. The GSP editor has coloring, highlighting of GSP tags, expressions and scriptlets. You can mix and match Java and Groovy as well.
P.S: Groovy and Grails home needs to be set from within the IDE NetBeans/Preferences as shown below:

Resources:
- Highlights of Beginning Groovy and Grails from Novice to Professional
- Groovy cross-platform installer
- Grails Quick Start in NetBeans IDE

July 21st, 2008 at 4:59 pm
[…] Read more: Grails development made even simpler using NetBeans IDE 6.5 Read the rest of the story… […]
July 21st, 2008 at 5:04 pm
[…] Original Source […]
July 22nd, 2008 at 9:34 pm
You should look at IntelliJ IDEA 7, its Groovy/Grails plugin is way beyond that of NetBeans and Eclipse.
July 23rd, 2008 at 1:00 am
Ok, so I have NetBeans 6.5M1. What does the Grails integration do for you that you couldn’t already do very easily?
July 23rd, 2008 at 10:21 am
[…] Is this even possible? Yes, trust me, if I can do it, so can you. You may ask, from Groovy and Grails in one day, how did I shift gears to web services. It all started while I was reading and working the samples from chapter 9 Web Services of “Beginning Groovy and Grails from Novice to Professional“. With the help of the sample provided in the book, I was able to get a RESTful web services for the Grails application. […]
July 23rd, 2008 at 3:56 pm
Jesse - I sure will look at IntelliJ IDEA 7.
Merlyn Albery-Spreyer - I am a big fan of automation, and don’t enjoy working with command prompts or terminals. I like to do everything from within my IDE, and that’s what NetBeans allows me to do.
July 24th, 2008 at 5:47 pm
IntelliJ’s Groovy and Grails is slick, but IntelliJ isn’t free…
The new NetBeans blows away any GoG options you had with Eclipse.
Merlyn might be referring to the fact that the Grails plugin was available in previous NetBeans dev builds. To finally see it on the roadmap for RC inclusion is awesome. It is also way more stable in 6.5M1 than in previous versions.