If you develop NetBeans modules you probably also wondered how to add a pre-packaged .nbm file as dependency to your module or how to use modules in multiple suites.
After some search I found that there is currently no official supported way for doing this. The reason is the bidirectional dependency between the suite and each module in the suite. This makes it hard to reuse modules across suites but it is still possible. In this entry I will try describe different techniques to workaround this issue.
In general, you can add a dependency to a module when the module you like to depend on is in:
a) your suite
b) the target NetBeans platform (default target platform is the installed IDE)
As mentioned above a) works only for one suite -> only b) is left
or put it in a build script
edit Info/index.xml inside your .nbm file and add global=true and targetcluster="milkyway"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//NetBeans//DTD Autoupdate Module Info 2.5//EN" "http://www.netbeans.org/dtds/autoupdate-info-2_5.dtd">
<module codenamebase="org.yourorghere.module4" distribution="" downloadsize="0" global="true" homepage="" license="AD9FBBC9" moduleauthor="Michael Bien" needsrestart="false" releasedate="2008/04/07" targetcluster="milkyway">
<manifest AutoUpdate-Show-In-Client="true" OpenIDE-Module="org.yourorghere.module4" OpenIDE-Module-Implementation-Version="080407" OpenIDE-Module-Java-Dependencies="Java > 1.5" OpenIDE-Module-Name="module4" OpenIDE-Module-Requires="org.openide.modules.ModuleFormat1" OpenIDE-Module-Specification-Version="1.1"/>
<license name="AD9FBBC9">[NO LICENSE SPECIFIED]
</license>
</module>
alternatively you can add the flags to module/nbproject/project.properties and rebuild/create NBM (if source available)
nbm.is.global=true nbm.target.cluster=milkywayNow when you install the module with Tools | Plugins, NetBeans will place the module directly into the installation folder in the new created "milkyway" cluster. With this trick you should be able to use the same library wrapper module in as many suites you want.
this HowTo was based on this blog entry
JesseGlick: probably simpler and easier is to make a suite containing all the modules you want to share across apps. Then use that to create a base platform (ant -f $suite/build.xml create-platform) for your other suites, following the instructions for "suite chaining" in harness/README.
JesseGlick: right, a prepackaged NBM needs to be unpacked into your target platform somehow. Simply unzipping it almost gets it right except that update_tracking/*.xml would be missing in that case (you could probably create it manually with a little experimentation). NB 6.0 has a new API for the Update Manager which may be helpful here.
FabrizioGiudici I'm adding another option, which again starts from .nbm files, but overcomes some limitations of suite chaining. It's definitely more complex than other solutions, but at the point it's the only viable option I've found for my needs: http://weblogs.java.net/blog/fabriziogiudici/archive/2007/11/netbeans_rcp_be.html