[ http://issues.apache.org/jira/browse/FELIXM2-5?page=comments#action_12443337 ] Lonnie Pryor commented on FELIXM2-5: ------------------------------------
John, Marking a dependency as "osgi-bundle" when using this patch will allow it to be passed to other projects transitively without embedding it in the resulting JAR. This should work even if the artifact targeted by the dependency is not actually an OSGi bundle. So yes, this patch should allow you to incrementally migrate your projects without disrupting your multi-project build. -Lonnie > Enable support for inter-bundle transitive dependencies > ------------------------------------------------------- > > Key: FELIXM2-5 > URL: http://issues.apache.org/jira/browse/FELIXM2-5 > Project: Felix M2 Plugin > Issue Type: New Feature > Affects Versions: 0.1.2, 0.1.3 > Environment: Multi-bundle build environemnt > Reporter: Lonnie Pryor > Assigned To: Timothy Bennett > Priority: Minor > Attachments: maven-osgi-plugin-transitiveDependencies-2-patch.txt, > maven-osgi-plugin-transitiveDependencies-patch.txt > > > The OSGi R4 specification supports transitive dependencies via the > "visibility:=reexport" directive on the "Require-Bundle" manifest header (see > OSGi Service Platform Core Specification, Release 4, Chapter 3, Section 13). > Unfortunately, the Felix M2 Plugin does not support declaring this kind of > relationship in the POM. > By only using the dependency scope setting, developers can declare that a > specific dependency is not to be embedded in the bundle, but that dependency > is then never transitively passed on to other projects. It would be optimal > if the Maven transitive dependency mechanism could be configured to mirror > the one provided by OSGi. > Since the OsgiJarMojo class only embeds dependencies with the "jar" type, a > transitive, non-embedded dependency can be declared by giving it a type of > "osgi-bundle". There are, however, a couple of issues with this approach: > 1.) The ArtifactHandler implementation configured in > META-INF/plexus/components.xml specifies "includesDependencies" as true. This > makes any dependencies inherited through an "osgi-bundle" typed dependency > unavailable to other phases of the build life cycle. Setting > "includesDependencies" to false will resolve this issue. While this change > will create more overhead during bundle builds (a bundle dependency and all > of its embedded dependencies will be downloaded separately), this is required > if any of the transitive dependencies are needed on the compile or test class > paths. > 2.) The OsgiJarMojo class currently embeds any dependency with the type "jar" > that is on the runtime or compile scope. With transitive dependencies as > described above enabled, all jars embedded in bundle dependencies will also > be embedded in the dependent bundle. To resolve this, the OsgiJarMojo class > should be changed to only embed dependencies with the type "jar", on the > runtime or compile scope, and not inherited from a dependency with the > "osgi-bundle" type. The latter can be accomplished by analyzing the the > contents of the getDependencyTrail() method for each candidate "jar" artifact. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira