By Geertjan on Jul 26, 2013
The Groovy support in NetBeans IDE is based on two use cases. In the first case, you're a Java programmer and want to use Groovy as a support language; therefore, in this scenario, you'll create a Java project and then add Groovy artifacts (Groovy classes and scripts) and go from there. In the second case, you're using Grails, in which case you'll go to the Groovy category in the New Project wizard (Ctrl-Shift-N) and create a Grails project and continue developing from that point onwards.
But what about if you don't care about Java and you don't care about Grails? You simply want to write Groovy scripts, compile them, debug them, and run them.
Download this plugin and install it into NetBeans IDE 7.3.1, which is the latest stable release of NetBeans IDE, though it may work in later versions of NetBeans IDE too:
Either install the plugin into the All distribution of NetBeans IDE 7.3.1 or first install the "Groovy & Grails" plugin (via Tools | Plugins) into any other download bundles of NetBeans IDE.
Now you have this new project available in the New Project wizard:
(Sorry for typo "Wheen" in above, will fix in next release...)
Complete the wizard and you should see this:
In other words, you have no Java source files at all, just a Groovy script, and the Groovy JAR (which you can change in the Project Properties dialog) and the JDK (which can also be changed in the Project Properties dialog).
Open the file and you see a Groovy editor:
Right-click in the left margin (or click on a line number) and you can set a breakpoint, visualized by a red line. Then start the Debugger (there's a Debug menu in the main menubar, take a look there).
Hope that helps Groovy purists get started with NetBeans IDE! Feedback welcome, e.g., let me know what other content you'd like the Groovy project to have.
Now go here to read about the latest Groovy features in NetBeans IDE:
In other news. I'm on vacation until Monday 5 August, if you don't hear from me before then, now you know why!