Geertjan's Blog

  • November 9, 2010

Consolidating Actions for Maven Based NetBeans Platform Applications (Part 1)

Geertjan Wielenga
Product Manager
I've been working with Maven-based NetBeans Platform applications a lot recently and... I like it. There are definitely things to get used to. The first stumbling block I encountered was understanding the responsibilities of the various project types in NetBeans IDE that you work with when developing Maven-based NetBeans Platform applications.

The reason for the confusion comes from the merging of the Maven concepts with the NetBeans Platform concepts. As a result, you have two project types 'above' the NetBeans module:

  • You have a project type for the NetBeans Platform application POM, which is just another module in a multi-modular Maven structure. For example, this is the project type responsible for running the application, since that is a NetBeans Platform-specific task.

  • You have a project type for the reactor POM, which is the POM responsible for Maven-specific activities involving multiple modules, including the application POM. For example, this project type is responsible for building all the modules in the application, since that is a Maven-specific task, i.e., a reactor build.

So, what do you do if you want to build all the modules AND run the application? Initially, you find yourself doing 'Build' on the Maven-specific project type and then doing 'Run' on the NetBeans Platform-specific project type.

That's kind of cumbersome. So, instead, do this. Go to the Project Properties of the NetBeans Platform-specific project type, i.e., the one with the orange icon. You'll see this panel:

Remove "install" from the Run Project action and click the "Build with Dependencies" checkbox. (Do the latter, because each of the modules that you build, thanks to 'build with dependencies', will also call 'install' for itself).

When you leave the Project Properties dialog, you'll have an "nbactions.xml" file, like this:

<?xml version="1.0" encoding="UTF-8"?>

So, now, when you do "Run" on the NetBeans Platform-specific project type, all the modules will also be built. That means you only have one command to invoke instead of two.

Does anyone out there have other handy tips for "nbactions.xml"? If so, feel free to leave them in the comments here...

Join the discussion

Comments ( 1 )
  • Michael Bedward Friday, April 29, 2011

    Nice one - thanks for this. When you're doing something hundreds of times you appreciate such little tips :)

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