1
votes

We have a Maven built Netbeans 7.1 rcp application that successfully mixes OSGi modules (packaging: bundle) and Netbeans modules (packaging: nbm) by wrapping the OSGi modules in Netbeans module wrappers. We want to migrate from using these wrappers to using the OSGi modules directly to simplify the build. There are around 30 wrapper, osgi module pairs and I would like to tackle the removal of the wrappers, one module pair at a time.

However when we replace a specific wrapper dependency with its osgi dependency in a modules pom that depends on it, and use the

    <useOSGiDependencies>true</useOSGiDependencies>

in the nbm-maven-plugin configuration. Any other dependencies to other wrappers suddenly fail to build with transitive dependencies not available at runtime error.

Project uses classes from transitive module [xxx] which will not be accessible at runtime.

-- where [xxx] is the name of the OSGi module.

Of course I can fix the build by replacing the wrapper dependencies with the OSGi modules they were wrapping, but that escalates the size of the migration task considerably. Once Ive got a build by "fixing" these transient dependencies the OSGi module that I picked to migrate appears successfully in a new cluster “extra”. But at runtime the rcp fails to find the other osgi modules because, I guess, elsewhere in the build, they are still being referenced through wrappers.

Is there any way these wrappers and direct OSGi dependencies can co-exist? Or do I have to migrate all of the Netbeans wrappers to OSGi in one go?

Many thanks,

Phil Wilkinson.

2

2 Answers

1
votes

Looks like theres no way to do this one wrapper at a time, its all-or-nothing with useOSGiDependencies. :(

0
votes

You can change them to useOSGiDependencies=true one module at a time.

A detailed step-by-step guide would probably be too long for an answer, so here are some general rules for this to work:

  1. Use nbm-maven-plugin version >= 3.11. Lower version has some bugs.
  2. NBM wrapper's OpenIDE-Module & OpenIDE-Module-Specification-Version must match the wrapped bundle's Bundle-SymbolicName & Bundle-Version respectively.
  3. If the bundle has package versioning, that has to be copied into the NBM wrapper's MANIFEST.MF as Netigso-Export-Package.