just to follow up on this question...

On 12/09/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> how does bnd analyze package dependencies? does it look at bytecode
> (from classes/jars) and its import statements? what about unused
> imports, are they included too? what is bnd analyzing (i guess compiled
> classes, and all project's dependent jars)?


BND is not involved in analyzing maven dependencies - the bundle plugin uses
the
maven project API to query the current project's dependencies (direct or
transitive
depending on Embed-Transitive) and uses Embed-Dependency to decide whether
to
add Include-Resource and Bundle-ClassPath clauses to embed the dependency.

however, orthogonal to the embed dependency feature BND does see the
complete
compilation classpath (minus provided dependencies) and "pulls" classes into
the
bundle using the Export-Package, Private-Package and Include-Resource
settings.

once it has the bundle contents it then looks at the contained bytecode to
find what
packages it needs to import (and calculates uses constraints, etc.)  BND
usually does
a good job at finding dependencies, but may miss them if, say, you use
reflection to
access packages at runtime

i am asking because i find it very weird that many packages
> (antlr,com.sun.msv.grammar,com.sun.msv.grammar.trex) show up, though my
> code does not use it. so the only point could be with external libraries
>

some tips that might help:

   mvn clean install -X

      this will tell you how maven is resolving dependencies and will
contain the
      compilation classpath (in the compiler plugin phase) - remember to
redirect
      output to a file, as it's very verbose

   mvn dependency:analyze

        analyzes your project to find undeclared / unused dependencies (very
useful)

HTH

-- 
Cheers, Stuart

Reply via email to