Geertjan's Blog

  • September 6, 2011

Gradle in NetBeans (Part 1)

Geertjan Wielenga
Product Manager

Martin Skurla and I have a basic Gradle plugin working in NetBeans IDE:

As you can see, ".gradle" files are recognized, are shown in the Projects window within a dedicated folder node, and are parsed to show Gradle tasks as children of the file node.

Then, when "Run Gradle" action is invoked on a Gradle task node, which also happens when the Gradle task node is double-clicked, the related Gradle task is run, with output in the Output window.

There's integration with the Groovy Editor, so that's how the syntax coloring and other editor features, such as mark occurrences, shown above, is provided.

We spent most of the time figuring out the regex expression for the node display name and on weird java.lang.ProcessBuilder syntax; the rest of the plugin is pretty standard NetBeans API code.

Not only supported in NetBeans modules, as you can see:

Now, does anyone know what a Gradle task for building a NetBeans module looks like? And for a standard Java SE application and for a web application? I.e., we need to map all the Ant tasks (build, run, debug) to Gradle tasks, if we're not mistaken in our understanding of Gradle.

Can anyone help answer this question or advise in any other way? What should the next features be that should be worked on in this context? And who would be interested in contributing code?

Join the discussion

Comments ( 8 )
  • funfried Tuesday, September 6, 2011

    Hi Geertjan,

    it seems you twitter account was hacked, I got a strange direct message from you within a even stranger link to a fake twitter page, I think you should change your pass.

    Kind regards,


  • Martijn Verburg Tuesday, September 6, 2011

    Whilst I can't help with code, I'll be happy to test out Gradle support as you build it - I'm familiar with Ant and Maven, but am new to Gradle. Looking forward to its support in Netbeans!

  • Rajmahendra Tuesday, September 6, 2011

    I am a big fan of Gradle so I can help in testing and comments. Once I get some knowledge in NB I can help in coding!


    You may display all the available tasks (output of 'gradle tasks' command) This may be too long display but you can group them like they display.

    I feel that we can have a separate syntax highlighter for Gradle. After all its a DSL :)

    A very nice attempt :) Keep it up and keep going.

  • Peter Belbin Wednesday, September 7, 2011

    I am interested in being able to do multi-project builds, and it seems like this might be one of the things that gradle is targetting.

    I presume the approach would be to create a project whose sole purpose in life is to orchestrate the overall build process.

    It seems that there is some overlap there between this type of project, and the project group. Would it make sense for a project group to be something that can be shared with others and have a build script associated with it? Perhaps it would be a project entity within which the project group definition and build script would be held to make it able to be versioned etc?

    ie: it would be nice to be able to share a project group with other developers and have a build script that would manage the correct build procedure for all projects in the group.

  • swpalmer Thursday, September 8, 2011

    This is excellent news.

    We've just con through some hell introducing Maven - which I now thoroughly hate - it is so inflexible and can only handle the most trivial of projects.

    We also had some very complex Ant scripts because at least you could do things with Ant even though it was awkward to work with it's XML.

    Then finally we tried Gradle and simplified so much, but there was no IDE support (the one good thing about Maven).

    I was hoping a NB plugin would appear soon... yahoo!

  • Nik Thursday, September 15, 2011

    Keep up the good work !!! I think gradle is the way forward but there wasn't a plugin for Netbeans until now. Any chance for a release date? :)

  • Alex K Friday, January 6, 2012

    Geertjan - do you know if this plugin was ever published somewhere (e.g. java.net , github ) ?

  • Geertjan Friday, January 6, 2012
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.