Richard S. Hall wrote:
Well, from my understanding of the situation, I think that embedding the native library should be reasonably straightforward using the Bundle Plugin...you just need to copy the native library into your bundle using <Include-Resource>, assuming that the native library is a resource in your project.

I may actually have this part working but I have compile errors (see below) so I'm not getting this far yet.

I want to embed a set of third party libraries in my bundle. This consists of five jars and one native code library (dbus-java-bin.jar, debug-disable.jar, hexdump.jar, libdbus-java.jar, unix.jar, and libunix-java.so). All of these files are in the lib directory of my project. I've added the following line to the project's pom.xml.

 <Include-Resource>lib=lib</Include-Resource>

That should embed the jar and so files. However, don't I still need a Bundle-NativeCode header? Something like

<Bundle-NativeCode>lib/libunix-java.so;osname=Linux;processor=x86</Bundle-NativeCode>

How might I do this?

The trickier part is dealing with the embedded JAR file, since Bundle Plugin doesn't handle embedding JARs very well at present. There was a proposal on how to deal with this in this mailing list thread:

http://mail-archives.apache.org/mod_mbox/felix-dev/200701.mbox/[EMAIL PROTECTED]

I guess we just need to actually implement the proposal now and that would solve your embedded JAR issue...I will create a JIRA issue out of this message and we can try to convince someone to work on it.

I saw FELIX-308, thanks.

In the meantime, you could use the old plugin to embed your dependencies...

Of course, all of this assumes that your embedded JAR files are maven dependencies in the first place...if they are just resources in your project, then you could use <Include-Resource> for them too.

I guess that's my first problem. I believe that the Include-Resource line above does this but I am getting compile errors. The compiler can't find any of the classes in my embeded jars. How do I get the embedded jars added to the class path? My understanding is that the Bundle-ClassPath header is automatically generated from the dependencies in the project's pom file. However, the embedded jar files are in the project directory, not in the maven repository. I'm pretty sure that my class path isn't correct which is why the compiler can't find the packages in the embeded jars.

-> richard

Tim Moloney wrote:
I'm trying to build a bundle that has both embedded jar files and a native code library. I've been looking for documentation/examples of how to build such a beast using maven and I've been unsuccessful. As an added bonus, I'd like to figure out how to use 'mvn eclipse:eclipse' to create the Eclipse files necessary to build this beast inside Eclipse. I've created a project from scratch in Eclipse and can successfully build it there but I'd like to 'mavenize' the process.

I did find the "simple" bundle in the Felix repo and I even found Felix-61 which should answer all my questions when it is completed.

Can anyone point out any documentation/examples that might help? Would someone wise in the ways of Maven/OSGi be willing to work on Felix-61?

Thanks,
 Tim



Reply via email to