You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com> on 2013/11/12 13:27:57 UTC

Maven bundle plugin with native libraries as resources

Dear Karaf exeperts,

I would like the maven bundle plugin to use native libraries stored in the repository. I tried Embed-Dependency with native libraries (.so & .dll). It succeeds but the Bundle-ClassPath is generated with them.

Is there a way to remove non-jar dependencies from the Bundle-ClassPath entry?

JP

Re: Maven bundle plugin with native libraries as resources

Posted by Łukasz Dywicki <lu...@code-house.org>.
In maven use:

<dependency>
	<groupId>com.mycompany.native</groupId>
	<artifactId>libname</artifactId>
	<version>x.y</version>
</dependency>

In maven bundle plugin then you may use:
<Embed-Dependency>*;artifactId=libname;inline=true</Embed-Dependency>
The libname.jar deployed to your maven repository must contain dll/so files.

Or
<dependency>
	<groupId>com.mycompany.native</groupId>
	<artifactId>libname</artifactId>
	<version>x.y</version>
	<type>dll</type>
</dependency>

<Embed-Dependency>*;type=dll|so</Embed-Dependency>

However from maven point of view packaging should be used instead of type.

In embed dependency you may use different filters - groupId, artifactId or even scope, so depends on the number of dependencies you may choose what's works for you.

Kind regards,
Łukasz Dywicki
--
luke@code-house.org
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org

Wiadomość napisana przez CLEMENT Jean-Philippe <je...@fr.thalesgroup.com> w dniu 14 lis 2013, o godz. 09:36:

> Right ;)
>  
> Well, the plugin assembled the bundle without issue *but* with native libraries stored in the resource directory. I would like the native libraries to be taken from the maven repository instead.
>  
> I didn’t find a simple way to do so. The bundle plugin has two issues. First all dependencies are added to the classpath no matter the dependency type (it adds .so and .dll as well!). Second the embedded file name keeps the maven format. Unfortunately the native file name is also its identifier so it must be changed. Note that using the Embed-StripVersion option fails as it also strips the classifier part (so two resources which only differs with the classifier attribute overloads each other).
>  
> Any idea?
>  
> JP
>  
> [@@ THALES GROUP INTERNAL @@]
>  
> De : Łukasz Dywicki [mailto:luke@code-house.org] 
> Envoyé : mercredi 13 novembre 2013 23:35
> À : user@karaf.apache.org
> Objet : Re: Maven bundle plugin with native libraries as resources
>  
> For native dependencies you need also Bundle-NativeCode manifest entry. Check OSGi Core specification for detailed description as well.
>  
> Cheers,
> Łukasz Dywicki
> --
> luke@code-house.org
> Twitter: ldywicki
> Blog: http://dywicki.pl
> Code-House - http://code-house.org
>  
> Wiadomość napisana przez CLEMENT Jean-Philippe <je...@fr.thalesgroup.com> w dniu 12 lis 2013, o godz. 13:27:
> 
> 
> Dear Karaf exeperts,
> 
> I would like the maven bundle plugin to use native libraries stored in the repository. I tried Embed-Dependency with native libraries (.so & .dll). It succeeds but the Bundle-ClassPath is generated with them.
> 
> Is there a way to remove non-jar dependencies from the Bundle-ClassPath entry?
> 
> JP


RE: Maven bundle plugin with native libraries as resources

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Right ;)

Well, the plugin assembled the bundle without issue *but* with native libraries stored in the resource directory. I would like the native libraries to be taken from the maven repository instead.

I didn’t find a simple way to do so. The bundle plugin has two issues. First all dependencies are added to the classpath no matter the dependency type (it adds .so and .dll as well!). Second the embedded file name keeps the maven format. Unfortunately the native file name is also its identifier so it must be changed. Note that using the Embed-StripVersion option fails as it also strips the classifier part (so two resources which only differs with the classifier attribute overloads each other).

Any idea?

JP

[@@ THALES GROUP INTERNAL @@]

De : Łukasz Dywicki [mailto:luke@code-house.org]
Envoyé : mercredi 13 novembre 2013 23:35
À : user@karaf.apache.org
Objet : Re: Maven bundle plugin with native libraries as resources

For native dependencies you need also Bundle-NativeCode manifest entry. Check OSGi Core specification for detailed description as well.

Cheers,
Łukasz Dywicki
--
luke@code-house.org<ma...@code-house.org>
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org

Wiadomość napisana przez CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>> w dniu 12 lis 2013, o godz. 13:27:


Dear Karaf exeperts,

I would like the maven bundle plugin to use native libraries stored in the repository. I tried Embed-Dependency with native libraries (.so & .dll). It succeeds but the Bundle-ClassPath is generated with them.

Is there a way to remove non-jar dependencies from the Bundle-ClassPath entry?

JP


Re: Maven bundle plugin with native libraries as resources

Posted by Łukasz Dywicki <lu...@code-house.org>.
For native dependencies you need also Bundle-NativeCode manifest entry. Check OSGi Core specification for detailed description as well.

Cheers,
Łukasz Dywicki
--
luke@code-house.org
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org

Wiadomość napisana przez CLEMENT Jean-Philippe <je...@fr.thalesgroup.com> w dniu 12 lis 2013, o godz. 13:27:

> Dear Karaf exeperts,
> 
> I would like the maven bundle plugin to use native libraries stored in the repository. I tried Embed-Dependency with native libraries (.so & .dll). It succeeds but the Bundle-ClassPath is generated with them.
> 
> Is there a way to remove non-jar dependencies from the Bundle-ClassPath entry?
> 
> JP