@Grab Support in IntelliJ IDEA

Recently I wrote about the great Grape stuff in Groovy for use when deploying groovy scripts.

Just wanted to give a quick view on what IDEA can do for you with some of the latest JetGroovy support for @Grab annotations. With my projects I use maven for building, and as such, I have my dependencies in the pom. I then use the excellent maven integration in IDEA by simply opening project from the pom.xml, hereby letting IDEA build dependencies for all modules. Works well.

With my groovy code module though, I have the dependencies listed as @Grab annotations instead, as that will help my deployment. What I do not want then, is to have to put them into the pom.xml too. In essence, IDEA should be able to add module dependencies by recoqnizing the @Grab annotations.

Luckily, this is under way, and you can already now try it out. There is a small extra Grab plugin, that needs to be installed. When you have that plugin installed, you get an intention action for the @Grab annotations, saying if you would like to download. If executed, they will also appear on the module dependencies, nicely marked with “Grab: ..” names.

For further info see this issue and the Grab plugin can be found here.

One small note: If running maven-based projects in IDEA like me, you might need this Ivy dependency

    <dependency>
        <groupId>org.apache.ivy</groupId>
        <artifactId>ivy</artifactId>
        <version>2.1.0</version>
    </dependency>

…in your pom to make the plugin work. I think a fix is under way for this though :-)

April 21, 2010 В· polesen В· No Comments
Tags: , , , ,  В· Posted in: Programming, Tools

Leave a Reply