Proprietary non-OSGi packages needed in OSGi application – can’t redistribute

I want to use proprietary, non-OSGi jars in an OSGi environment. For development, we just repackage/export it with the Maven bundle plugin [1]. Problem is, for legal reasons we won’t be able to redistribute these packages to our customer, which kills both embedding and repackaging, which are (AFAIK) the only options (see [2]).

Before using OSGi, we had a section in our manual describing how to put these files in a library folder after acquiring them on ones own. Given OSGi rules for resolving classes, this obviously won’t work anymore.

Am I correct to assume that the only way to solve this is a legal one, i.e. getting a redistribution license from the packages’ vendor (which may be a beurocratic nightmare and impede timely delivery), or am I missing a technical solution?

[1] How can I share non-OSGi libraries between bundles in an OSGi container?

[2] Non-osgi library usage in an osgi application

Answer

I would simply add this JAR to the main Java application classpath, using its existing location in a library folder as you have already established. Then you can export the packages you need into OSGi using the org.osgi.framework.system.packages.extra property.

Leave a Reply

Your email address will not be published. Required fields are marked *