My seemingly simply goal was to take a library of mine with a (seemingly) short list of dependencies, and turn it into a self-contained OSGi bundle that would be comprehensible to the Eclipse IDE.
The short list of dependencies includes Spring, and here I think is where I got into trouble. I know that there are OSGi bundles for Spring, but, for this rather simple exercise, I just wanted to put Spring inside my bundle, unexported. Spring appears to have a whole, complex, list of undeclared (from a Maven standpoint) dependencies. Bnd+the bundle plugin thus produces a long list of Import-Packages for code that I don't actually need or want. cglib, jruby, bsh, etc. Judging from some examples to I could find, this requires me to find all these things and explicitly list them as Import-Package instructions with the optional flag. What I was hoping was some way to get the tools to omit or 'optional' packages like this. Now, part of my problem is that I'm not clear on the division of labor between bnd and maven-bundle-plugin -- does bnd know the classpath so that it could put 'optional' on things that are not on it? I can send you my various bits and pieces, but this might be enough to clarify. On Thu, Feb 12, 2009 at 12:43 AM, Stuart McCulloch <[email protected]>wrote: > 2009/2/12 Benson Margulies <[email protected]> > > > I am trying to wrap a maven artifact that depends on spring in a bundle, > > and > > just make it self-contained. > > > > I used pax to make a simple pom for the bundle plugin. > > > > Eclipse throws up all over the results, because it has a giant > > Import-Package list. It includes internal packages from the JVM, things > > that > > are in the wrapped dependencies, you name it. > > > > I have this feeling that I'm missing something awfully simple, but I > don't > > know what. > > > > there is something missing... > > 1) what command did you use to create the pom? (arguments, etc) > 2) what version of the maven-bundle-plugin are you using? > 3) did you modify the pom, and if so what did you change? > (or paste the full pom + Bnd instructions in your message) > 4) what combination of OS+Java+Maven are you using? > > note that if your wrapped dependencies do use non java.* packages > from the JVM (for example com.sun...) then these will automatically > be imported because they are referenced in the bytecode > > but from your brief description it sounds like you have an excessive > wildcard somewhere in your Private-Package or Export-Package > and that's pulling the entire classpath into your bundle. > > -- > Cheers, Stuart >

