Geertjan's Blog

  • November 4, 2013

Groovy Grapes in NetBeans IDE

Geertjan Wielenga
Product Manager

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.

Join the discussion

Comments ( 4 )
  • Jan Monday, November 4, 2013

    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.


  • Mark Kerzner Tuesday, November 5, 2013

    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.

  • guest Friday, May 30, 2014

    Hi how to configure grape service?

    does it still work on netbean 8 ?

    Thanks for answer

  • Bob Namestka Tuesday, July 22, 2014

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


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.