[
https://issues.apache.org/jira/browse/FELIX-5074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14953027#comment-14953027
]
Konrad Windszus commented on FELIX-5074:
----------------------------------------
Actually it is not that simple, because for
org.osgi.service.component.ComponentContext there are only the following
dependencies available:
http://search.maven.org/#search|ga|1|fc%3A%22org.osgi.service.component.ComponentContext%22%20g%3A%22org.osgi%22
Only since DS 1.3 there is a dedicated artifact for something related to OSGi
services.
Therefore maybe the right solution is to somehow invert the classloading order,
so that {{bndlib}} is always loaded first before the {{felix.scr.bnd}} artifact
is being loaded. That way {{bndlib}} would loads its own classes and
{{felix.scr.bnd}} would preferably leverage the classes from {{bndlib}} and
only if they are not contained in {{bndlib}} use its own versions of those
classes.
The problem with that is how to modify the class loading order.
Currently the loading order is:
# maven-bundle-plugin-3.0.0.jar
# org.apache.felix.scr.bnd-1.4.0.jar
# org.osgi.core-4.3.1.jar
# biz.aQute.bndlib-3.0.0.jar
To modify that {{felix.scr.bnd}} would need to depend on {{bndlib}} as well.
Unfortunately {{bndlib}} changed its artifactId from {{bndlib}} to
{{biz.aQute.bndlib}} in version 2.4.1. Therefore it seems impossible to have
the same version of {{felix.scr.bnd}} for both bnd < 2.4.1 and bnd >= 2.4.1.
> Using org.apache.felix.scr.bnd together with maven-bundle-plugin leads to
> using the wrong bnd version
> -----------------------------------------------------------------------------------------------------
>
> Key: FELIX-5074
> URL: https://issues.apache.org/jira/browse/FELIX-5074
> Project: Felix
> Issue Type: Bug
> Components: SCR Tooling
> Affects Versions: scr bnd plugin 1.4.0
> Reporter: Konrad Windszus
> Attachments: pom.xml
>
>
> If I have a POM with a plugin configuration like this
> {code}
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>3.0.0</version>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <!-- support parsing of felix annotations through the felix.scr.bnd
> plugin -->
>
> <_plugin>org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
> </instructions>
> </configuration>
> <dependencies>
> <!--
> https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd -->
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.apache.felix.scr.bnd</artifactId>
> <version>1.4.0</version>
> </dependency>
> </dependencies>
> </plugin>
> {code}
> Unfortunately {{org.apache.felix.scr.bnd}} depends on
> {{biz.aQute.bnd:bndlib:jar:2.1.0}}. Therefore the classpath of
> maven-bundle-plugin looks like this:
> {code}
> [DEBUG] Populating class realm
> plugin>org.apache.felix:maven-bundle-plugin:3.0.0
> [DEBUG] Included: org.apache.felix:maven-bundle-plugin:jar:3.0.0
> [DEBUG] Included: org.apache.felix:org.apache.felix.scr.bnd:jar:1.4.0
> [DEBUG] Included: biz.aQute.bnd:bndlib:jar:2.1.0
> [DEBUG] Included: org.osgi:org.osgi.core:jar:4.3.1
> [DEBUG] Included: biz.aQute.bnd:biz.aQute.bndlib:jar:3.0.0
> [DEBUG] Included:
> org.apache.felix:org.apache.felix.bundlerepository:jar:1.6.6
> [DEBUG] Included: org.easymock:easymock:jar:2.5.2
> [DEBUG] Included: org.apache.felix:org.apache.felix.utils:jar:1.6.0
> [DEBUG] Included: org.osgi:org.osgi.compendium:jar:4.2.0
> [DEBUG] Included: org.slf4j:slf4j-jdk14:jar:1.5.6
> [DEBUG] Included: org.slf4j:slf4j-api:jar:1.5.6
> [DEBUG] Included: org.slf4j:jcl-over-slf4j:jar:1.5.6
> [DEBUG] Included: org.apache.maven.reporting:maven-reporting-api:jar:2.2.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-logging-api:jar:1.1
> [DEBUG] Included: junit:junit:jar:4.11
> [DEBUG] Included: org.hamcrest:hamcrest-core:jar:1.3
> [DEBUG] Included: commons-cli:commons-cli:jar:1.2
> [DEBUG] Included:
> org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
> [DEBUG] Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
> [DEBUG] Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3
> [DEBUG] Included: org.sonatype.plexus:plexus-cipher:jar:1.4
> [DEBUG] Included: org.apache.maven:maven-archiver:jar:2.5
> [DEBUG] Included: org.codehaus.plexus:plexus-archiver:jar:2.1
> [DEBUG] Included: org.codehaus.plexus:plexus-io:jar:2.0.2
> [DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.15
> [DEBUG] Included: org.apache.maven.shared:maven-dependency-tree:jar:2.1
> [DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
> [DEBUG] Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
> [DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.10
> [DEBUG] Included: org.sonatype.plexus:plexus-build-api:jar:0.0.7
> [DEBUG] Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-site-renderer:jar:1.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-core:jar:1.0
> [DEBUG] Included: org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7
> [DEBUG] Included: org.codehaus.plexus:plexus-velocity:jar:1.1.7
> [DEBUG] Included: org.apache.velocity:velocity:jar:1.5
> [DEBUG] Included: commons-lang:commons-lang:jar:2.1
> [DEBUG] Included: oro:oro:jar:2.0.8
> [DEBUG] Included: org.apache.maven.doxia:doxia-decoration-model:jar:1.0
> [DEBUG] Included: commons-collections:commons-collections:jar:3.2
> [DEBUG] Included: org.apache.maven.doxia:doxia-module-apt:jar:1.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-module-fml:jar:1.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-module-xdoc:jar:1.0
> [DEBUG] Included: org.apache.maven.doxia:doxia-module-xhtml:jar:1.0
> [DEBUG] Excluded: org.apache.maven:maven-core:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-settings:jar:2.2.0
> [DEBUG] Excluded:
> org.apache.maven:maven-plugin-parameter-documenter:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-profile:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-model:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-artifact:jar:2.2.0
> [DEBUG] Excluded:
> org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
> [DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-error-diagnostics:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-project:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-plugin-registry:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-artifact-manager:jar:2.2.0
> [DEBUG] Excluded: org.apache.maven:maven-monitor:jar:2.2.0
> [DEBUG] Excluded: classworlds:classworlds:jar:1.1
> {code}
> So the classpath contains both bnd 2.1 and bnd 3.0.
> IMHO the {{felix.scr.bnd}} should not transitively influence the classpath. I
> guess marking the dependency to bnd as provided in its pom.xml should do the
> trick here!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)