Make netty-transport-native-epoll-*-linux-x86_64.jar working in OSGi

Motivation:

Currenlty, netty-transport-native-epoll-*-linux-x86_64.jar is not packed as OSGi bundle
and thus not working in OSGi environment.

Modifications:

In netty-transport-native-epoll's pom.xml added configuration
to attach manifest to the jar with a native library.
In netty-common's pom.xml added configuration instruction (DynamicImport-Package)
to maven bnd plugin to make sure the native code is loaded from
netty-transport-native-epoll bundle.

Result:

The netty-transport-native-epoll-*-linux-x86_64.jar is a bundle (MANIFEST.MF attached)
and the inluced native library can be successfuly loaded in OSGi environment.
Fixing #5119
This commit is contained in:
Milos Fabian 2016-05-07 20:41:19 +01:00 committed by Norman Maurer
parent db6b72da19
commit 4c186c4c41
2 changed files with 28 additions and 0 deletions

View File

@ -138,6 +138,27 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<id>generate-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<!-- NativeLibraryLoader can be used to manually load native libraries from other bundles that this bundle does not depend on,
hence use DynamicImport-Package instruction to ensure the loading is successful -->
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -105,6 +105,13 @@
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>
<configuration> <configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<index>true</index>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<classifier>${epoll.classifier}</classifier> <classifier>${epoll.classifier}</classifier>
</configuration> </configuration>
</execution> </execution>