Geertjan's Blog

  • November 3, 2014

How to Build NetBeans Modules with Gradle

Geertjan Wielenga
Product Manager

On Twitter I saw an announcement by Gradleware's Radim Kubacki re Gradle and NetBeans module support recently:

I got quite some help from Radim and below are my basic instructions for getting started with early support for building NetBeans modules via Gradle.

Curious to know what a Gradle NetBeans module looks like? Here, in the Projects window, take a very first look at a Gradle NetBeans module, the first screenshot ever taken of this cool thing:

Take the steps as follows to get set up.

  1. Install Gradle and make sure it works on the command line.

  2. git clone https://github.com/radimk/gradle-nbm-plugin.git or use the Git tools in the IDE to do the checkout. The result is shown below:

  3. Close the IDE.

  4. On the command line, go to the 'standalone' folder that you see above, which is within the 'samples' folder.

  5. Run this Gradle command on the command-line:

    gradle -PnetBeansInstallDir="C:/Program Files/NetBeans 8.0.1" netbeans netBeansRun

Instead of "C:/Program Files", use whatever equivalent on Linux or whatever to specify the installation directory of NetBeans IDE.

The 'standalone' module, the sources of which look as shown below (in the Files window, while the Projects window displays the logical view as shown in the first hierarchical-structure screenshot in this blog entry) if you install the "Gradle Support" plugin, is now built (via the 'netbeans' task above), while the IDE automatically starts up together with an extra cluster containing the module (via the 'netBeansRun' task above), so that the module is installed in the IDE while it starts up.

To verify everything has succeeded in this sample scenario, go to the Help menu and you should see a "Say hello" menu item (which does nothing when you click it).

Now read this, which is referenced in the Tweet with which this blog entry started, and study the Gradle files in the 'sample' module shown above. Then try to apply the above procedure to your own NetBeans modules.


This is, as you can see from the above, all done from the command line. In a next blog entry, we'll show how to do this within the IDE itself. We'll also learn how to build Gradle NetBeans modules from scratch. And how to migrate existing Ant or Maven modules to Gradle. Anyone can figure these things out on their own after setting up their initial environment as described above. Choice is good and being aware of the choices available to you is therefore also good.

Would be pretty cool if Gradle were to be introduced to development teams at Boeing, NASA, NATO, etc, thanks to the new possibilities that are now exposed to NetBeans Platform developers everywhere, who are always focused on creating large meaningful applications in a wide range of software industries.

Join the discussion

Comments ( 2 )
  • Matias Wednesday, June 17, 2015

    Hi, i need some help with gradle and netbeans platform.

    where i can get the gradle plugin?

    and if i have a java project with gradle and i want to migrate to netbeans platform with the gradleplugin how can i do it?


  • Geertjan Thursday, June 18, 2015

    I don't understand the question. Doesn't this blog entry tell you where to get the plugin? Anyway, here, again: https://plugins.gradle.org/plugin/cz.kubacki.nbm

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