Groovy Grapes in NetBeans IDE

The start of Groovy Grapes support in NetBeans IDE. Below you see a pure Groovy project, with the Groovy JAR and the Ivy JAR automatically on its classpath. There's also a Groovy script that makes use of a @Grab annotation. In the bottom left, in the Services window, you also see a Grape Repository browser, i.e., showing you the JARs that are currently in ".groovy/grapes". Click the images below to get a better look at them.

Next, you see what happens when the project is run. The @Grab annotation automatically starts downloading the JARs that are needed and puts them into the ".groovy/grapes" folder. However, the "no suitable classloader found for grab" error message (which Google shows is a problem for lots of developers) prevents the application from running successfully:

The final screenshot shows that I've put the JARs that I need onto the classpath of the project. I did that manually, hoping to learn from the NetBeans Maven project or the NetBeans Gradle project how to do that automatically. Also note that the @Grab annotation has been commented out. Now the error message about the classloader is avoided and the project runs.

What needs to happen for Groovy Grapes support to be complete in NetBeans IDE:

  • Figure out how to add the downloaded JARs to the project classpath automatically.
  • Fix the refresh problem in the Grape Repository browser, i.e., right now the refresh doesn't happen automatically yet.
  • Hopefully find a way to get around the grab classloader problem, i.e., it's not ideal that one needs to comment out the annotation.
  • Let the user specify a different Grape repository, i.e., right now ".groovy/grapes" is assumed, but the user should be able to point the repository browser to something different. Maybe there should be support for multiple Grape repositories?

Comments/feedback/help is welcome.


Thanks for the update, hope you guys can come up with a permanent solution that comes out of the box. That way I can maybe convince my team mate who went back to eclipse because of this issue, to come back to NB.


Posted by Jan on November 04, 2013 at 03:26 PM PST #

Somewhat off-topic: on my last contract I suffered for NetBeans. I heard things like "who in the world uses NB?" and "If only we can get you off NB!" and "It creates too much junk for you (meaning its refactoring advice".

Please teach me what to answer next time :)

Thank you.

Posted by Mark Kerzner on November 04, 2013 at 09:30 PM PST #

Hi how to configure grape service?

does it still work on netbean 8 ?

Thanks for answer

Posted by guest on May 30, 2014 at 03:45 PM PDT #

Geertjan, how do we get this working in Netbeans 8? Really need to do some Groovy scripting and want to stay with Netbeans.


Posted by Bob Namestka on July 22, 2014 at 08:23 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016