Using 3rd party code in your OSGi bundle is possible in a number of ways.
Firstly, in most cases someone has already done the work. The Apache ServiceMix project contains a large number of OSGi-ified jar files. Newer versions of libraries have often been updated to include OSGi metadata, and you can always submit patches! Secondly, you can just embed the code in your bundle. You can do this by using Conditional-Package or Private-Package in your bnd file (Gradle or Maven). This is obviously duplicative, but it avoids the need for a separate wrapping project, and you can be selective about what you include. You can see a discussion of why this can be a good thing at https://github.com/njbartlett/njbartlett.github.com/blob/master/_posts/2014-05-26-static-linking.md <https://github.com/njbartlett/njbartlett.github.com/blob/master/_posts/2014-05-26-static-linking.md>. When using Maven you might also consider using the shade plugin, but this does not play nicely with the OSGi manifest generation, and is probably best avoided. Thirdly, wrapping a jar is also very easy, and pretty much identical in Maven and Gradle. Simply create a build project, and add a dependency on the JAR you want to wrap. Then add a bnd file and use it to select the packages that you want to be: Exported Private You may also need to customise the package imports to ensure correct version ranges, and to remove any “difficult” dependencies that aren’t actually needed. Effectively, there’s nothing special about Maven here, just keep following the same recommendations that have been there for the last 10 years :) Best Regards, Tim > On 28 Jun 2018, at 04:45, Paul F Fraser via osgi-dev <osgi-dev@mail.osgi.org> > wrote: > > There has been some discussion in the bndtools list about handling 3rd part > non OSGi jars. > > How can this be done in the new maven enRoute, if possible? > > Paul Fraser > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev