Skip to content

Create a zip distribution of a netbeans rcp with maven

The nbm-plugin lets you compile and cluster netbeans modules and suites. It’s pretty simple to get it up and running. However, the nbm plugin does not support a “zip-distribution” goal.

This can be achieved using the assembly plugin. It will gather all launchers, config files and the modules and zip them.

So let imagine we have an application where the suite is called “mysuite”. In the suite we’ll have to configure the assembly plugin, add the following to your pom.xml:

 
  ....
 
                maven-assembly-plugin
 
                        src/main/assembly/distribution.xml

Create a assembly descriptor in src/main/assembly named distribution.xml :

<!--?xml version="1.0" encoding="UTF-8"?-->
 
    bin
 
zip
 
        <!-- Launchers -->
 
            ${netbeans.install}/harness/launchers/app.sh
            bin/
            ${project.name}
 
            ${netbeans.install}/harness/launchers/app.exe
            bin/
            ${project.name}.exe
 
            ${netbeans.install}/harness/launchers/app_w.exe
            bin/
            ${project.name}_w.exe
 
        <!-- etc directory stuff -->
 
            ${netbeans.install}/harness/etc/app.conf
            etc/
            ${project.name}.conf
 
            src/main/assembly/netbeans/mysuite.clusters
            etc/
            ${project.name}.clusters
 
        <!-- Your app's cluster-->
 
            ${project.build.directory}/netbeans_clusters/${project.name}
            mysuite
 
                **/**
 
        <!-- netbeans' platform-->
 
            ${netbeans.install}/platform8
            platform8
 
                **/**

In this descriptor I’m assuming your suite’s name is the same as your project’s name and you defined a property “netbeans.install” that points to installation directory of netbeans. I am using netbeans 6.1, if you are using 6.0 you will have to change plaform8 for platform7 in the last part of the assembly descriptor.

In line 31 we copy a file that you should create and include the clusters of your application. For this example the file should only contain one line with the name of our suite (mysuite).

After you create the mysuite.clusters files in the right place, you are all set. To create your zip distribution you simply run:

$mvn clean install nbm:cluster assembly:assembly

If everything works fine you should find a “mysuite-1.0-SNAPSHOT-bin.zip” file in your target directory. Now you can copy that file anywhere you what, unzip it and run you RCP application.

Of course your “netbeans.install” property could be defined using profiles if you are using Continuum or any other CI server.

I hope this was useful. Happy coding.

{ 1 } Comments

  1. formacion bonificada | July 27, 2012 at 1:39 pm | Permalink

    Greetings! Very useful advice in this particular article!
    It’s the little changes which will make the most important changes. Thanks a lot for sharing!