Geertjan's Blog

  • January 6, 2010

10 Steps to Get Started with Maven on the NetBeans Platform

Geertjan Wielenga
Product Manager
Aside from the (currently) missing exhaustive reference material for the NetBeans Platform (mitigated by the NetBeans API javadoc and Essential NetBeans Platform Reference Card), the other BIG gap in the NetBeans Platform documentation is... everything relating to Maven. Much can be discovered via google (e.g., type the following keywords in google "NetBeans Platform Maven" and/or "NetBeans RCP Maven").

However, the official docs all assume you're using Ant to build your application. Time to fix that.

Here's a start. Simple NetBeans Platform "getting started" scenario (plus some interesting benefits over Ant) via Maven and a bunch of screenshots.

  1. Go to the New Project wizard, choose the Maven project type, and click Next:

  2. Choose the Maven NetBeans Platform Application Archetype and click Next:

  3. Enter a name for your application and other stuff, including a main package, which (just for fun) I have here specified to indicate that this application is being developed for the Skyguide team (visited by Toni and myself last year and they're doing great with the NetBeans Platform, last I heard):

  4. Click Finish and then the IDE shows you the project structure of the folders and files that have been created on disk:

  5. However, maybe you reckon that IntelliJ IDEA provides a better perspective. No worries, just open the 'pom.xml' file created for the application into the (free!) community edition of IntelliJ IDEA and then you're good to go:

    Note: Follow these steps to set up the classpath correctly for using the NetBeans Platform in IntelliJ IDEA.

  6. Use the "New Window Component" wizard in NetBeans IDE to create a new window in the application:

  7. Run the application (from wherever you like, including the command line), open a few windows, and here's the starting point of the brilliant application you're about to create:

  8. Ask yourself this simple question: "How much coding have I done to get to the above state of my application?"


  9. Then use the Matisse GUI Builder in NetBeans IDE to add UI elements to the window you generated earlier.

  10. Next, if that's your preference, use IntelliJ IDEA again for the coding of the business logic of your application. I.e., in this scenario, NetBeans IDE is a simplistic code generator, while IntelliJ IDEA is your code editor. The dependency graph for Maven applications is fun too:

Hurray, you're up and running with the NetBeans Platform for Maven-based applications! What should be addressed next in this Maven-based series of blog entries? Tell me and I will write it!

Join the discussion

Comments ( 14 )
  • guest Wednesday, January 6, 2010

    It shows that NetBeans is poor for Maven project navigation and code editing. Otherwise, why would you introduce IntelliJ IDEA here.

  • Mikael Tollefsen Thursday, January 7, 2010

    Add the following to your pom.xml to use OfficeLAF












    <name>Repository hosting the jee6 artifacts</name>




  • guest Thursday, January 7, 2010

    Add the following to your pom.xml to use the OfficeLAF


















    <name>Repository hosting the jee6 artifacts</name>




  • Peter Levart Thursday, January 7, 2010

    Hello Geertjan,

    I too am trying to collect bits and pieces regarding Maven and NetBeans platform together. I started a process of migrating 3 different Swing GUIs, which are part of a bigger project built by Maven, into one integrated GUI supported by NetBeans platform. I'm using nbm-maven-plugin 3.1 to build NetBeans modules (nbm packaged artefacts).

    The main problem I'm currently facing is the following:

    nbm-maven-plugin packages a NetBeans module from classes/resources that are part of nbm module and adds propper NetBeans MANIFEST entries for dependent nbm modules etc. If nbm module being built is also dependent on jar modules then jar artefacts of those modules are packaged as private libraries of the nbm module. So if I have two nbm modules dependent on the same jar module, this jar module will be packaged twice as a private library of each nbm module. Besides redundancy this also has undesired effect if this jar library should be shared because it maintains internal state in static fields.

    The obvious answer to this problem is to change all jar modules into nbm modules. This can be done for internal modules but our code also depends on numerous third-party libraries which are managed outside via Maven. I would not like to maintain nbm module wrappers for all those external libraries but I'm afraid there's no other alternative. Or is there and I just can't spot it?


  • Fabrizio Giudici Thursday, January 7, 2010

    Peter, you can have a look at


    While it started for my own needs, the idea is to have the thing used by others. For this to happen, it probably needs some work - but we'll never know if nobody else tries it.

    In any case, using wrapper modules is the way to go.

    @ No question IDEA has got a lot of smart things, even though I personally don't see the need for using it. Keeping on with comparing IDEs and Maven, one could try to open the Maven project with Eclipse and enjoy the big mess it will make.

  • Milos Kleint Thursday, January 7, 2010


    You should have just one module that bundles the non-module jars. If you have independent one, you might ship with 2 modules, but it's still not recommended. So for any 3rd party jars you will have to create a wrapper module that other modules depend on, it can contain code on it's own, have it's own public api etc. The other modules need to depend on this one, not the non-module jars. That's the way it works and honestly I don't see any other way around it.

    The dependency resolution rules are described in the nbm plugin docs.


  • Raul Arabaolaza Friday, January 8, 2010


    Great blog, this series come just in time for my needs. :).

    The Maven archetype seems to generate Netbeans 6.7 applications, so instrucctions to upgrade to 6.8 could be very helpfull, by changing platform and netbeans version in pom.xml to platform11 and release68 seem not to work.


  • Jos&eacute; Luis S&aacute;nchez Friday, January 8, 2010


    Can you explain how to import a maven project into Netbeans ?


  • psychollek Saturday, January 9, 2010

    has anybody tried and succeded in creating a jee client application on top of 6.8 with a maven build ? preferably without wiring to the specific server jars (altough I use jee6 so right now I don't have much of choice ;])

  • jdbmonitor Sunday, January 17, 2010

    good to know that maven based netbeans platform development is getting more focus. any idea if it will (hopefully) be the 'default' way for developing netbeans RCP applications?

    would be good to have more tutorials/docs on:

    - reference to map netbeans API dependencies (i.e. Datasystems API, Lookup API, Projects API, Projects UI API, etc.) to Maven dependencies

    - how to exclude certain module dependencies when using a specific cluster.

    - well, basically all the configurations that we can do from nb rcp project's 'important files' that we now have to tweak from pom.xml... how's it done....

    its a lot of guesswork and experiments now...

  • you-wanna-fork-the-RCP Friday, January 22, 2010

    If the NetBeans team ever tries to make Maven the "default", then enterprising developers such as myself will fork the code base and strip out any reference to the worst build tool (Maven) that ever was.

  • Jani-the-Newbee Sunday, November 7, 2010

    Can u write about importing a maven project to netbeans from a remort repository like in the case of Funambol. And I wanna know whether Maven 3.1 and above is backward compatible. That's to say, the stuff like Funambol V8 which is primarily based on maven 2.0 would work with the newer versions of maven and in netbeans in particular.

    Many Thanks in advance


  • akshay Thursday, December 26, 2013

    Netbeans 7.0 + ,include full support for maven. So it makes easy to import maven projects. very informative tutorial sir. Thank you

  • guest Sunday, October 9, 2016

    i created a java ee7 maven project in Netbeans 8.1, though the project created successfully but i can't see it in the Netbeans environment but found in the folder for my project and anytime i try opening it, it just can be visible in the IDE

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