Geertjan's Blog

  • May 15, 2008

Zipping A Suite's NBM Files for Distribution

Geertjan Wielenga
Product Manager
One of the many nice people I met at JavaOne was Mark Stephens, from IDR Solutions. Mark and a colleague did a very interesting BOF about how they created their JPedal viewer plugin for each of the main IDEs (i.e., IntelliJ, NetBeans IDE, and Eclipse). He highlighted various things that were cool and not so cool about creating plugins for each of the IDEs. One of the things he told me was that the "Build ZIP Distribution" menu item on the project node of module suite projects is confusing. He had expected to be able to choose that menu item and then get a ZIP file containing all the NBMs in the suite. Instead, the menu item resulted in an application being created, i.e., including a launcher and a bin folder and so on.

However, Mark's usecase was different: his suite contained a number of different modules which he wanted to upload to the Plugin Portal. However, one can only upload one file to a new Plugin Portal entry. Either one uploads one NBM file or one ZIP file. Mark, having multiple NBM files in his plugin, thus chose "Build ZIP Distribution" on the suite project and was disappointed/confused to discover that he was then prompted to make the suite an application after which he still didn't get his NBMs zipped up into a suite. As pointed out above, the purpose of that menu item is different to what Mark had expected. Therefore, I created a plugin today that provides this functionality:

Get it here:


I think everything is explained on that page. The menu item is only shown for module suite projects. The ZIP file is created via an Ant script that is created in the tmp directory and then removed after the target has completed. The Ant target simply runs the "nbms" target, which every module suite project has, thus creating all the NBM files into the build/updates folder and then picks up all the NBM files in that folder and ZIPs them up. (The only problem is that I can't put the menu item higher in the contextual menu, because ideally it would appear right beneath the existing "Build ZIP Distribution" item, but currently that's not possible.) If you are a NetBeans module developer and are interested in how all this is done, click here and you will get the Action's source file. (Click here to see the related layer file.) Comments/critiques/feedback on this functionality is/are welcome.

Today on NetBeans Zone. Two NetBeans Keyboard Shortcuts That Will Change Your Life (Forever)

Join the discussion

Comments ( 2 )
  • mark stephens Monday, May 19, 2008

    It works really nicely. Thanks for implementing it.

  • Jordi R Cardona Tuesday, May 20, 2008

    Great module Geertjan! It's something that most people would like to use.

    A really useful module, should be included in Netbeans IDE.

    Only a suggestion: when I package mine for distribution in a zip I use to include 3 txt files that are a readme, a install note and the license.

    It would be perfect that in a future version some files many be included like this when one packages the nbms.

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