Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSGI nested dependency jars

Tags:

osgi

If I have a OSGI Bundle that has dependency jars nested inside the OSGI Bundle jar, do I need to list those classes in the Import-Package manifest so that I could use them? I would think not.

Also how do I add these dependency jars into my bundle. Do I just put them in the root folder? Do I need to add anything to the manifest file to be able to use these dependencies?

like image 231
user1159819 Avatar asked May 26 '26 17:05

user1159819


2 Answers

Avoid using Bundle-ClassPath manually. You can use maven-bundle-plugin to solve and embed your third party dependencies like this:

<plugins>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<configuration>
    <instructions>
    <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
    <Bundle-Version>${project.version}</Bundle-Version>
    <Export-Package>lumina.extensions.drivers.luminadb</Export-Package>
    <Bundle-Activator>lumina.extensions.drivers.luminadb.internal.Activator</Bundle-Activator>
    <Embed-Dependency> YOUR ARTIFACT ID HERE </Embed-Dependency>
    </instructions>
</configuration>
</plugin>
(...)

</plugins>

For more information visit http://web.ist.utl.pt/ist162500/?p=110

like image 149
PedroD Avatar answered Jun 04 '26 12:06

PedroD


You should not use Import-Package for embedded jars. Instead use Bundle-ClassPath: .,myjar.jar to add the embedded jars to the bundle classpath.

like image 20
Christian Schneider Avatar answered Jun 04 '26 14:06

Christian Schneider



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!