[
https://issues.apache.org/jira/browse/FELIX-5074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14952705#comment-14952705
]
Konrad Windszus commented on FELIX-5074:
----------------------------------------
Hi Pierre,
thanks for your feedback on my patch. Ok, so it seems we need to rethink the
patch. But only setting bndlib to "provided" will only resolve one part of the
issue. The other issue that we should not include the same class within the
classpath of bndlib twice remains. Let me quickly summarize what is part of
bndlib 3.0 and bndlib 2.1
bndlib 3.0
# org.osgi.resource
# org.osgi.service.component.annotations
# org.osgi.service.metatype.annotations
# org.osgi.service.repository
bndlib 2.1
# org.osgi.resource
# org.osgi.service.component.annotations
# org.osgi.service.repository
Those packages should not be contained in {{felix.scr.bnd}}, otherwise you run
into problems. But the issue is that those packages are part of osgi.compendium
as well. Therefore I think we must depend on something less generic than
osgi.compendium.
What is needed at runtime by {{felix.scr.bnd}} really should be only:
# org.osgi.service.component.ComponentContext
# org.osgi.framework.BundleContext
All the other references really seem to be constants (which are in any case
being inlined by the compiler).
So maybe depending on
http://search.maven.org/#artifactdetails|org.osgi|org.osgi.service.component|1.3.0|jar
seems better as that includes only the relevant package (but is only available
for DS 1.3, though).
> 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)