Niclas Hedhman wrote:
On Friday 09 February 2007 08:05, Carlos Sanchez wrote:
ok, so there's no "transitive dependency" thing like Maven has,


Speaking of that; IMHO If artifact A dependsOn artifact B which dependsOn artifact C, then the transitive dependency should not provide C's classes to A at compile time. Reason; If A uses anything directly in C, it would mean that if a later version of B stop using C, A becomes 'unusable'.

Fast forward to OSGi; If you had the somewhat broken way of Maven allowing B to automagically supply classes to A, then if one replaces B with another implementation then A breaks. Therefor, A imports the C packages explicitly, if they are needed, but if it is only internal use of C in B then it would not require A to know about C.

Correct. The transitive type of dependency in OSGi is captured by "uses" constraints, but this is still done in terms of packages. For example, bundle A can export package 'foo' and export (or import) package 'bar' and can declare that 'foo' uses 'bar'. This tells the framework that if bundle B imports 'foo' and is wired to bundle A's 'foo', then if bundle B imports 'bar' it must also get that from bundle A (or from the same place as bundle A if a imports 'bar').

Thus, bundle A can inform the framework about transitive dependencies so that it can resolve package dependencies in a consistent way for a set of bundles. But, as Niclas points out, even then this does not automagically give bundle B access to these "used" packages, bundle B must still explicitly import them to have access to them.

-> richard

Try to stop thinking "bundles" and start thinking "packages". Bundles are typically not referenced at all, especially not the generic case for the maven-jar-plugin, which is what I am hoping you are working on.



Cheers
Niclas

Reply via email to