FYI, to play well with Eclipse PDE (which doesn't necessarily know about
embedded jars) I usually do the following:
1) use maven-dependency-plugin to copy compile time dependencies to
"target" folder
2) update Include-Resource to embed them inside the bundle as
"target/example.jar"
3) update the Bundle-ClassPath to include an entry for
"target/example.jar"
the benefit is that the jarfile in the project folder is where Eclipse PDE
expects it (based on the Bundle-ClassPath)
The latest version of Pax-Construct (which I'll mention in my OSGi Community
Event talk) provides a single script to do this for you (pax-embed-jar), as
long as you created the project using Pax-Construct - but this approach can
be used in any maven project.
You can also adapt this to unpack jars inside bundles while still keeping
Eclipse PDE happy:
1) use maven-dependency-plugin to copy compile time dependencies to
"target" folder
2) update Include-Resource to inline them inside the bundle using
"@target/example.jar"
( or use pull-approach of Bnd to include specific packages with
Private/Export-Package )
3) update the Bundle-ClassPath to include an entry for
"target/example.jar" -- this is just for PDE
4) add a zero-size placeholder jar to the bundle by updating
Include-Resource like so:
target/example.jar=placeholder.jar
where placeholder.jar is a zero-size file in your project -- this
is needed because of 3)
again, Pax-Construct can do this for you (add "-- -Dunpack=true" to the
pax-embed-jar command).
On 20/06/07, Richard S. Hall <[EMAIL PROTECTED]> 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.
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.
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.
-> 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
>
--
Cheers, Stuart