Geertjan's Blog

  • May 23, 2008

10 Steps to Happiness with Maven and the NetBeans Platform

Geertjan Wielenga
Product Manager
If you're interested in Maven and NetBeans IDE, you should definitely read Best Practices for Apache Maven in NetBeans 6.x, by Milos Kleint, the developer of Maven support in NetBeans IDE. There is an incredible amount of tips and tricks in there, from getting started, to deployment, to optimizing your editing experience. It is probably the most important document you will ever find on Maven and NetBeans IDE. Another crucial article is NetBeans Platform Development with Maven 2 by Emilian Bold, although the archetypes used in this blog entry did not exist at the time that Emilian wrote that article. However, everything in that article is of vital importance to you if you are using Maven to create your NetBeans Platform application/s.

Now let's create our first NetBeans Platform application via the tailor-made NetBeans Platform Maven archetype provided by the NetBeans Maven plugin for NetBeans IDE 6.1.

  1. Start NetBeans IDE 6.1 and install the Maven plugin (Tools | Plugins | Available Plugins).

  2. Go to the New Project wizard (Ctrl-Shift-N) and choose Maven | Maven Project and then click Next.

  3. Choose "Maven Netbeans Platform Application Archetype":

    Click Next.

  4. Very important: Don't forget to fill out the details at the bottom of the dialog:

    The 'brandingtoken' and the 'cluster' could be set to anything. The 'brandingtoken' is used during the customization phase of your application, i.e., to distinguish it from other applications. You need to set this here so that you're aware of what the token is later. However, this will not be very important to you (at all) in the greater part of your development process. The 'cluser' determines the name of the folder that will contain your custom modules, i.e., those that are in addition to the clusters of modules provided by the NetBeans Platform. Again, the cluster name is not very important and can be modified later anyway.

    The 'netbeans-install' field is very important. Later, when you run the application, the application will need to know the location of a NetBeans installation. Above, I have set "/home/geertjan/netbeans-6.1" because that is the top level folder of my NetBeans installation.

    Make sure that you press Enter for each of the fields, otherwise the entered text wont't "take" and the wizard will assume that the field is empty, causing problems later when you try to deploy it. There should be default values for all of the above fields; this is a known problem and will be fixed at some point.

  5. Click Finish and observe the two projects in the Projects window. The first is for the application and the second for a dummy module. You can use that module as your starting point and then add more as needed. Here's what you should see:

    There's one small yet very important thing that should be tweaked (again, a known problem). Open the profiles.xml file that you see above. In there, you'll see an element named "netbeans.installation.directory":

    Change that element name to "netbeans.installation". It is a known bug.

  6. Right-click the application and choose Build. It is very important that you do this, because the Run action won't do it for you, so that you'll have deployment problems in the next step if you haven't built the application first.

  7. Now right-click the application and choose Run. This will run the application and you'll see the splash screen of NetBeans IDE 6.1 and then your new application:

    Now, even though our first module doesn't do anything yet, we'll add a second module to our application. To do this, we will need to create our new module in the same folder as where the application is found. Look at step 4 above and notice that we will need to create our new module in "/home/geertjan/NetBeansProjects/DemoRCPApp". OK, let's do it via a new archetype in the next step.

  8. Press Ctrl-Shift-N again and choose Maven | Maven Project | Maven NetBeans Module Archetype:

    Click Next.

  9. Specify the location of the application, as pointed out above:

  10. Click Finish and now you can see that your application consists of two modules (in addition to the modules that the NetBeans Platform makes available):

Now refer to the two articles at the start of this blog entry which, together, should give you everything you need when working with Maven and the NetBeans Platform.

Join the discussion

Comments ( 18 )
  • fiony Friday, May 23, 2008

    that very intersting!

  • Blogumdan Friday, May 30, 2008

    Thanks a lot. REally, interesting.

  • mirc Wednesday, September 24, 2008

    fine thenks

  • Danny Thursday, December 11, 2008

    Hi Geertjan,

    have the following problems to run a rcp project in Netbeans 6.1 and Netbeans 6.5 under the given tutorial. I can't find the reason to resolve this.

    I hope you can help me.

    Thanks a lot,





    NetBeans: Executing 'mvn.bat -Pnetbeans-location nbm:cluster nbm:run-platform'

    NetBeans: JAVA_HOME =C:\\Programme\\Java\\jdk1.6.0_10

    Scanning for projects...

    Searching repository for plugin with prefix: 'nbm'.


    Building DemoRCPApp - NetBeans Platform Application

    task-segment: [nbm:cluster, nbm:run-platform] (aggregator-style)



    Created NetBeans module cluster(s) at C:\\Dokumente und Einstellungen\\User\\Desktop\\NetBeansProject\\DemoRCPApp - NetBeans Platform Application (pom)\\target/netbeans_clusters


    Executing: "C:\\Programme\\NetBeans 6.5\\platform9\\lib\\nbexec.exe" --userdir '"C:\\Dokumente und Einstellungen\\User\\Desktop\\NetBeansProject\\DemoRCPApp - NetBeans Platform Application (pom)\\target\\userdir"' -J-Dnetbeans.logger.console=true -J-ea --branding demotoken --clusters '"C:\\Dokumente und Einstellungen\\User\\Desktop\\NetBeansProject\\DemoRCPApp - NetBeans Platform Application (pom)\\target\\netbeans_clusters\\rcpapp"'

    Der Befehl "C:\\Programme\\NetBeans" ist entweder falsch geschrieben oder

    konnte nicht gefunden werden.




    Total time: 2 seconds

    Finished at: Thu Dec 11 12:58:29 CET 2008

    Final Memory: 2M/5M


  • mırc Saturday, February 14, 2009


  • Toni Epple Wednesday, February 25, 2009

    Hi Geertjan,

    Thanks for this blog entry. In the current Module for 6.5 you need to do a little trik to get the Run Action to work:


    Cheers Toni

  • Cody Friday, March 27, 2009


  • Steve Taylor Saturday, March 28, 2009

    Hi Geertjan.

    Thanks for this excellent information. Perhaps it's time for an updated version of this article.

    Using the 1.1 archetypes for applications and modules, I was able to avoid the need to define the three additional properties in the wizard. Perhaps you could include that in an updated article. Hopefully the 1.0.2 archetypes will soon get ditched in the maven netbeans archetype list.


  • Steve Taylor Saturday, March 28, 2009

    It would be nice to see a follow-up article, perhaps explaining things like how to get NB platform components onto the palette so they can be used in the GUI builder.

  • guest Friday, May 8, 2009

    ERROR]Mojo (aggregator):

    [ERROR] org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-3:generate

    [ERROR]FAILED while executing in directory:

    [ERROR] /home/wilfredo/NetBeansProjects


    [ERROR]Archetype org.codehaus.mojo.archetypes:netbeans-platform-app-archetype:1.0.2 is not configured

    [ERROR]Error stacktrace:

    [ERROR]org.apache.maven.AggregatedBuildFailureException: Build in root directory: /home/wilfredo/NetBeansProjects failed during execution of aggregator mojo: org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-3:generate

    [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:279)

    [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:180)

    [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)

    [ERROR] at org.netbeans.modules.maven.embedder.exec.MyLifecycleExecutor.execute(MyLifecycleExecutor.java:94)

    [ERROR] at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)

    [ERROR] at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)

    [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)

    [ERROR] at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)

    [ERROR] at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)

    [ERROR] at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)

    [ERROR] at org.netbeans.modules.maven.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:233)

    [ERROR] at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)

    [ERROR]Caused by: org.apache.maven.plugin.MojoFailureException: Archetype org.codehaus.mojo.archetypes:netbeans-platform-app-archetype:1.0.2 is not configured

    [ERROR] at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute(CreateProjectFromArchetypeMojo.java:202)

    [ERROR] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)

    [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)

    [ERROR] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)

    [ERROR] ... 11 more

  • Moses Gone Wednesday, June 17, 2009

    Thanks a lot for the tutorial. I was previously using non maven Application platform project, and I ran into a big problem with Wrapper modules and dependencies. So I switched to maven and things seems a lot better. However, I have a problem now that in a module where I have set dependencies to my api, it takes ages for maven to build this module(roughly 5-6 minutes)


    NBM Plugin generates manifest

    Adding on module's Class-Path:










    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!

    skip non existing resourceDirectory C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\src\\test\\resources


    Not compiling test sources


    Tests are skipped.


    Adding existing MANIFEST to archive. Found under: C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\target\\classes\\META-INF\\MANIFEST.MF

    Building jar: C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\target\\TransformersView-1.0-SNAPSHOT.jar


    Copying module jar to C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\target\\nbm\\netbeans\\foobar\\modules

    [WARNING] Cannot find license file at C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\license.txt

    [WARNING] You don't define distributionUrl parameter in the nbm-maven-plugin configuration. That's ok for local installation but f you want to create an autoupdate site, you have to define this property.

    [WARNING] Using default value for distribution URL: null


    Installing C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\target\\TransformersView-1.0-SNAPSHOT.jar to C:\\Users\\mgone\\.m2\\repository\\eu\\esdihumboldt\\TransformersView\\1.0-SNAPSHOT\\TransformersView-1.0-SNAPSHOT.jar

    Installing C:\\Users\\mgone\\Documents\\NetBeansProjects\\WorkflowFrontend\\TransformersView\\target\\TransformersView-1.0-SNAPSHOT.nbm to C:\\Users\\mgone\\.m2\\repository\\eu\\esdihumboldt\\TransformersView\\1.0-SNAPSHOT\\TransformersView-1.0-SNAPSHOT.nbm




    Total time: 5 minutes 33 seconds

    Finished at: Wed Jun 17 10:20:51 CEST 2009

    Final Memory: 21M/52M

    This is really annoying, how can I fix this? I dont even know where the problem is.


  • Zoltán Baráti Wednesday, February 17, 2010

    Hi Geertjan,

    I do like the maven+NetBeans platform combo and I welcomed the new features in 6.9M1 for example one from File>New Project>Maven>Maven NetBeans module

    I tought I'll try but no luck because

    The desired archetype does not exist (org.codehaus.mojo.archetypes:nbm-archetype:1.3-SNAPSHOT)

    Do you think I should fill in a bug for this or just wait till someone deploys it

    Do you happen to know a rep where I can get org/codehaus/mojo/archetypes/nbm-archetype/1.3-SNAPSHOT/nbm-archetype-1.3-SNAPSHOT.jar ?

    kind regards,


  • Narayan Friday, December 9, 2011

    Do you have an updated set of instructions for 7.0.1 netbeans. I don't see some of the screens the same way as posted.


  • Geertjan Friday, December 9, 2011

    Can you give a small clue which screens you're talking about?

  • Narayan Monday, December 12, 2011

    Sorry I wasn't clear about the screens. I am using Maven 7.0.1.

    To create a module suite which consists of list of netbeans modules that will be portable to eclipse,

    I assume I have create Netbeans Module suite. Correct me if I am wrong. My module suite has bunch of netbeans modules under it. I don't even see the screen in step 4.

    Please advice on direction to take.

  • guest Monday, December 12, 2011

    Maven 7.0.1? Are you sure? Maven is at version 3 at the moment, I believe. And who said anything anywhere about "NetBeans modules that will be portable to Eclipse"? And where in the steps above do you see anything about a Netbeans Module suite? Sorry, can't help you, nothing you've said makes sense. Maybe write to the mailing list (dev@platform.netbeans.org) and see if someone can help you there.

  • Narayan Tuesday, December 13, 2011

    Sorry for the typo. I meant netbeans 7.0.1

  • Geertjan Tuesday, December 13, 2011

    This blog entry was written in 2008... so why not use the official tutorial instead on the official tutorial site:


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