On 13 March 2010 16:31, Pascal Kesseli <[email protected]> wrote:

> Are you telling me that I can't use Spring with maven-bundle-plugin? That
> seems a bit cheap. What separates Spring so much from other libraries -
> except that it has quite the dependency list?
>

I think Justin meant why are you embedding Spring when it's already
available as a bundle, and you can map Spring beans to components
in OSGi using Spring-DM: http://www.springsource.org/osgi

Back to the original question - you are getting a lot of imports because
certain Spring artifacts have a lot of transitive dependencies. Let's look
at your Embed-Dependency instruction:

   <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
   <Embed-Transitive>true</Embed-Transitive>

Here you're asking the bundleplugin to embed all dependencies from the
Maven classpath that have either compile or runtime scope. You're also
asking it to consider transitive dependencies. Looking at your pom this
is the main Spring artifact and the aspects jar.

For Spring this probably ends up being a lot of artifacts - you can easily
check this by using "jar tvf <file>" or "unzip -l <file>" to see what's in
the
final bundle. These will be the artifacts from the entire Spring dependency
tree that had compile or runtime scope.

However this won't include any dependencies that had provided scope,
because that's not one of the scope values used in your embed filter.

The Bnd tool will automatically add imports when it finds bytecode in
the final bundle that refers to a package, and that package is not part
of the final bundle. So your large import list is because you embed a
lot of jars that refer to packages in other dependencies with provided
scope.

For example you might find you're embedding some Spring database
artifacts, but not the actual database driver artifacts - hence you'll get
imports for all the referenced (but missing) database packages.

If you know you don't use certain packages at runtime you can tell Bnd
to ignore them by adding a negative entry to Import-Package like so:

  <Import-Package>!javax.*, *</Import-Package>

(the trailing wildcard is so Bnd still adds the other packages to the list)

But given Spring already provides bundles, it will be much easier to use
them directly than try to embed Spring yourself and deal with the mess.

HTH


>
> -----Ursprüngliche Nachricht-----
> Von: Justin Edelson [mailto:[email protected]]
> Gesendet: Freitag, 12. März 2010 19:38
> An: [email protected]
> Betreff: Re: <Embed-Dependency> mess
>
> On 3/12/10 12:29 PM, Pascal Kesseli wrote:
> > What is going on here? What am I missing?
>
> In brief... don't embed Spring.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> Eingehende eMail ist virenfrei.
> Von AVG überprüft - www.avg.de
> Version: 8.5.436 / Virendatenbank: 271.1.1/2741 - Ausgabedatum: 03/12/10
> 09:42:00
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

-- 
Cheers, Stuart

Reply via email to