[
https://issues.apache.org/jira/browse/FELIX-5993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jiri Daněk updated FELIX-5993:
------------------------------
Description:
Consider the linked reproducer project (just the pom.xml in attachment, no
sources needed).
{code}
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<!--https://issues.apache.org/jira/browse/FELIX-5698-->
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>3.5.0</version>
</dependency>
</dependencies>
<configuration>
<instructions>
<Bundle-SymbolicName>com.redhat.mqe.${bundle.symbolic.name.suffix}</Bundle-SymbolicName>
<Export-Package>com.redhat.mqe.${bundle.symbolic.name.suffix}</Export-Package>
<Import-Package></Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Require-Capability>osgi.ee</Require-Capability>
</instructions>
<finalName>${jar.finalName}-${library.version}</finalName>
</configuration>
</plugin>
{code}
It consists of two dependencies, qpid-jms in the compile scope, and two
activemq-artemis artifacts in the test scope. They all have dependency on netty.
Build the project and look for class ByteToMessageDecoder in the bundle
{noformat}
mvn package
jar -tf target/jarFinalName-libraryVersion.jar | grep ByteToMessageDecoder
{noformat}
The class is missing.
Now remove the two test dependencies from the pom.xml file and do the above
commands again.
The class is now found
{noformat}
% jar -tf target/jarFinalName-libraryVersion.jar| grep ByteToMessageDecoder
io/netty/handler/codec/ByteToMessageDecoder$1.class
io/netty/handler/codec/ByteToMessageDecoder$2.class
io/netty/handler/codec/ByteToMessageDecoder$Cumulator.class
io/netty/handler/codec/ByteToMessageDecoder.class
{noformat}
h3. Expected result
I need to have ByteToMessageDecoder in my bundle, regardless of what other test
dependencies I am including to the project. My project requires that class to
function.
h3. My understanding of the cause
The class is contained in netty-codec jar.
The qpid-jms wants to bring version 4.1.31 of netty-codec, and activemq-artemis
wants 4.1.24. The older one wins, but in the dependency tree, that included
netty-codec is a child of a test-scoped artifact now.
When the felix bundle plugin searches the dependency tree, it goes only through
artifacts which can be reached through compile- and runtime-scoped
dependencies, and it misses this one.
This means, that the mvn dependency:tree -Dverbose looks like this (being aware
of limitations of -Dverbose)
{noformat}
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
felix-bundle-test-inclusion-bug ---
[INFO] com.rathate.mqe.apache:felix-bundle-test-inclusion-bug:jar:1.0-SNAPSHOT
[INFO] +- org.apache.qpid:qpid-jms-client:jar:0.38.0:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +-
org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:compile
[INFO] | +- org.apache.qpid:proton-j:jar:0.30.0:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.31.Final:compile
[INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | +- io.netty:netty-common:jar:4.1.31.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- io.netty:netty-codec:jar:4.1.24.Final:compile
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +- io.netty:netty-transport:jar:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | \- io.netty:netty-resolver:jar:4.1.31.Final:compile
[INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +-
io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +-
io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile
[INFO] | | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +-
io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +-
(io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | \- io.netty:netty-codec-http:jar:4.1.31.Final:compile
[INFO] | \- (io.netty:netty-codec:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] +- org.apache.activemq:artemis-amqp-protocol:jar:2.6.3:test
[INFO] | +- org.apache.activemq:artemis-jms-client:jar:2.6.3:test
[INFO] | | +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
omitted for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-selector:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | \-
(org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:test - omitted
for duplicate)
[INFO] | +- org.apache.activemq:artemis-selector:jar:2.6.3:test
[INFO] | | \- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | +- org.apache.activemq:artemis-core-client:jar:2.6.3:test
[INFO] | | +- org.jgroups:jgroups:jar:3.6.13.Final:test
[INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +-
(org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test -
omitted for duplicate)
[INFO] | | +- org.apache.johnzon:johnzon-core:jar:0.9.5:test
[INFO] | | +-
(io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] | | +-
(io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-codec:jar:4.1.24.Final:test - omitted for
conflict with 4.1.24.Final)
[INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | +- org.apache.activemq:artemis-commons:jar:2.6.3:test
[INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | \- (commons-beanutils:commons-beanutils:jar:1.9.3:test - omitted
for duplicate)
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:test
[INFO] | +- (org.apache.activemq:artemis-server:jar:2.6.3:test - omitted for
duplicate)
[INFO] | +- org.apache.activemq:artemis-journal:jar:2.6.3:test
[INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-native:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | +- (org.apache.qpid:proton-j:jar:0.27.3:test - omitted for conflict
with 0.30.0)
[INFO] | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | \- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] \- org.apache.activemq:artemis-server:jar:2.6.3:test
[INFO] +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- (org.apache.activemq:artemis-selector:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- org.apache.activemq:artemis-jdbc-store:jar:2.6.3:test
[INFO] | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted
for duplicate)
[INFO] | \- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
omitted for duplicate)
[INFO] +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test - omitted
for duplicate)
[INFO] +- org.apache.activemq:artemis-native:jar:2.6.3:test
[INFO] | \- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +-
(io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] +-
(io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-codec:jar:4.1.24.Final:compile - scope updated
from test; omitted for duplicate)
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:test
[INFO] | +- commons-logging:commons-logging:jar:1.2:test
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:test
[INFO] +- commons-io:commons-io:jar:2.6:test
[INFO] \-
org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test
{noformat}
You can see that e.g. netty-codec does not appear in a chain of compile scoped
dependencies, because it is instead captured in the test dependencies.
I'd expect that Embed-Dependency would still embed netty-codec into the bundle,
because it is needed by the app itself, not just tests. This is not what
happens, though.
was:
Consider the linked reproducer project (just the pom.xml in attachment, no
sources needed). It consists of two dependencies, qpid-jms in the compile
scope, and two activemq-artemis artifacts in the test scope. They all have
dependency on netty.
Build the project and look for class ByteToMessageDecoder in the bundle
{noformat}
mvn package
jar -tf target/jarFinalName-libraryVersion.jar | grep ByteToMessageDecoder
{noformat}
The class is missing.
Now remove the two test dependencies from the pom.xml file and do the above
commands again.
The class is now found
{noformat}
% jar -tf target/jarFinalName-libraryVersion.jar| grep ByteToMessageDecoder
io/netty/handler/codec/ByteToMessageDecoder$1.class
io/netty/handler/codec/ByteToMessageDecoder$2.class
io/netty/handler/codec/ByteToMessageDecoder$Cumulator.class
io/netty/handler/codec/ByteToMessageDecoder.class
{noformat}
h3. Expected result
I need to have ByteToMessageDecoder in my bundle, regardless of what other test
dependencies I am including to the project. My project requires that class to
function.
h3. My understanding of the cause
The class is contained in netty-codec jar.
The qpid-jms wants to bring version 4.1.31 of netty-codec, and activemq-artemis
wants 4.1.24. The older one wins, but in the dependency tree, that included
netty-codec is a child of a test-scoped artifact now.
When the felix bundle plugin searches the dependency tree, it goes only through
artifacts which can be reached through compile- and runtime-scoped
dependencies, and it misses this one.
This means, that the mvn dependency:tree -Dverbose looks like this (being aware
of limitations of -Dverbose)
{noformat}
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
felix-bundle-test-inclusion-bug ---
[INFO] com.rathate.mqe.apache:felix-bundle-test-inclusion-bug:jar:1.0-SNAPSHOT
[INFO] +- org.apache.qpid:qpid-jms-client:jar:0.38.0:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +-
org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:compile
[INFO] | +- org.apache.qpid:proton-j:jar:0.30.0:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.31.Final:compile
[INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | +- io.netty:netty-common:jar:4.1.31.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- io.netty:netty-codec:jar:4.1.24.Final:compile
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +- io.netty:netty-transport:jar:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | \- io.netty:netty-resolver:jar:4.1.31.Final:compile
[INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +-
io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +-
io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile
[INFO] | | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | +-
io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.31.Final:compile
[INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] | | +-
(io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
for duplicate)
[INFO] | \- io.netty:netty-codec-http:jar:4.1.31.Final:compile
[INFO] | \- (io.netty:netty-codec:jar:4.1.31.Final:compile - omitted for
duplicate)
[INFO] +- org.apache.activemq:artemis-amqp-protocol:jar:2.6.3:test
[INFO] | +- org.apache.activemq:artemis-jms-client:jar:2.6.3:test
[INFO] | | +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
omitted for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-selector:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | \-
(org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:test - omitted
for duplicate)
[INFO] | +- org.apache.activemq:artemis-selector:jar:2.6.3:test
[INFO] | | \- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | +- org.apache.activemq:artemis-core-client:jar:2.6.3:test
[INFO] | | +- org.jgroups:jgroups:jar:3.6.13.Final:test
[INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +-
(org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test -
omitted for duplicate)
[INFO] | | +- org.apache.johnzon:johnzon-core:jar:0.9.5:test
[INFO] | | +-
(io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] | | +-
(io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-codec:jar:4.1.24.Final:test - omitted for
conflict with 4.1.24.Final)
[INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | +- org.apache.activemq:artemis-commons:jar:2.6.3:test
[INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | \- (commons-beanutils:commons-beanutils:jar:1.9.3:test - omitted
for duplicate)
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:test
[INFO] | +- (org.apache.activemq:artemis-server:jar:2.6.3:test - omitted for
duplicate)
[INFO] | +- org.apache.activemq:artemis-journal:jar:2.6.3:test
[INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +- (org.apache.activemq:artemis-native:jar:2.6.3:test - omitted
for duplicate)
[INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | +- (org.apache.qpid:proton-j:jar:0.27.3:test - omitted for conflict
with 0.30.0)
[INFO] | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] | \- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] \- org.apache.activemq:artemis-server:jar:2.6.3:test
[INFO] +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- (org.apache.activemq:artemis-selector:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted for
duplicate)
[INFO] +- org.apache.activemq:artemis-jdbc-store:jar:2.6.3:test
[INFO] | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
for duplicate)
[INFO] | +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted
for duplicate)
[INFO] | \- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
omitted for duplicate)
[INFO] +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test - omitted
for duplicate)
[INFO] +- org.apache.activemq:artemis-native:jar:2.6.3:test
[INFO] | \- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
for duplicate)
[INFO] +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
conflict with 4.1.31.Final)
[INFO] +-
(io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] +-
(io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
omitted for conflict with 4.1.31.Final)
[INFO] +- (io.netty:netty-codec:jar:4.1.24.Final:compile - scope updated
from test; omitted for duplicate)
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:test
[INFO] | +- commons-logging:commons-logging:jar:1.2:test
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:test
[INFO] +- commons-io:commons-io:jar:2.6:test
[INFO] \-
org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test
{noformat}
You can see that e.g. netty-codec does not appear in a chain of compile scoped
dependencies, because it is instead captured in the test dependencies.
I'd expect that Embed-Dependency would still embed netty-codec into the bundle,
because it is needed by the app itself, not just tests. This is not what
happens, though.
> Depending on how Maven resolves dependencies, Embed-Dependency may miss some
> dependencies
> -----------------------------------------------------------------------------------------
>
> Key: FELIX-5993
> URL: https://issues.apache.org/jira/browse/FELIX-5993
> Project: Felix
> Issue Type: Bug
> Components: Maven Bundle Plugin
> Affects Versions: maven-bundle-plugin-4.0.0
> Reporter: Jiri Daněk
> Priority: Major
> Attachments: pom.xml
>
>
> Consider the linked reproducer project (just the pom.xml in attachment, no
> sources needed).
> {code}
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <executions>
> <execution>
> <phase>package</phase>
> <goals>
> <goal>bundle</goal>
> </goals>
> </execution>
> </executions>
> <!--https://issues.apache.org/jira/browse/FELIX-5698-->
> <dependencies>
> <dependency>
> <groupId>biz.aQute.bnd</groupId>
> <artifactId>biz.aQute.bndlib</artifactId>
> <version>3.5.0</version>
> </dependency>
> </dependencies>
> <configuration>
> <instructions>
>
> <Bundle-SymbolicName>com.redhat.mqe.${bundle.symbolic.name.suffix}</Bundle-SymbolicName>
>
> <Export-Package>com.redhat.mqe.${bundle.symbolic.name.suffix}</Export-Package>
> <Import-Package></Import-Package>
> <DynamicImport-Package>*</DynamicImport-Package>
>
> <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
> <Embed-Transitive>true</Embed-Transitive>
> <Require-Capability>osgi.ee</Require-Capability>
> </instructions>
> <finalName>${jar.finalName}-${library.version}</finalName>
> </configuration>
> </plugin>
> {code}
> It consists of two dependencies, qpid-jms in the compile scope, and two
> activemq-artemis artifacts in the test scope. They all have dependency on
> netty.
> Build the project and look for class ByteToMessageDecoder in the bundle
> {noformat}
> mvn package
> jar -tf target/jarFinalName-libraryVersion.jar | grep ByteToMessageDecoder
> {noformat}
> The class is missing.
> Now remove the two test dependencies from the pom.xml file and do the above
> commands again.
> The class is now found
> {noformat}
> % jar -tf target/jarFinalName-libraryVersion.jar| grep
> ByteToMessageDecoder
> io/netty/handler/codec/ByteToMessageDecoder$1.class
> io/netty/handler/codec/ByteToMessageDecoder$2.class
> io/netty/handler/codec/ByteToMessageDecoder$Cumulator.class
> io/netty/handler/codec/ByteToMessageDecoder.class
> {noformat}
> h3. Expected result
> I need to have ByteToMessageDecoder in my bundle, regardless of what other
> test dependencies I am including to the project. My project requires that
> class to function.
> h3. My understanding of the cause
> The class is contained in netty-codec jar.
> The qpid-jms wants to bring version 4.1.31 of netty-codec, and
> activemq-artemis wants 4.1.24. The older one wins, but in the dependency
> tree, that included netty-codec is a child of a test-scoped artifact now.
> When the felix bundle plugin searches the dependency tree, it goes only
> through artifacts which can be reached through compile- and runtime-scoped
> dependencies, and it misses this one.
> This means, that the mvn dependency:tree -Dverbose looks like this (being
> aware of limitations of -Dverbose)
> {noformat}
> [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
> felix-bundle-test-inclusion-bug ---
> [INFO] com.rathate.mqe.apache:felix-bundle-test-inclusion-bug:jar:1.0-SNAPSHOT
> [INFO] +- org.apache.qpid:qpid-jms-client:jar:0.38.0:compile
> [INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
> [INFO] | +-
> org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:compile
> [INFO] | +- org.apache.qpid:proton-j:jar:0.30.0:compile
> [INFO] | +- io.netty:netty-buffer:jar:4.1.31.Final:compile
> [INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | +- io.netty:netty-common:jar:4.1.31.Final:compile
> [INFO] | +- io.netty:netty-handler:jar:4.1.31.Final:compile
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | +- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
> for duplicate)
> [INFO] | | \- io.netty:netty-codec:jar:4.1.24.Final:compile
> [INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile -
> omitted for duplicate)
> [INFO] | +- io.netty:netty-transport:jar:4.1.31.Final:compile
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | \- io.netty:netty-resolver:jar:4.1.31.Final:compile
> [INFO] | | \- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
> for duplicate)
> [INFO] | +-
> io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.31.Final:compile
> [INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | +-
> io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile
> [INFO] | | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted
> for duplicate)
> [INFO] | | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile -
> omitted for duplicate)
> [INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
> for duplicate)
> [INFO] | +-
> io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.31.Final:compile
> [INFO] | | +- (io.netty:netty-common:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] | | +-
> (io.netty:netty-transport-native-unix-common:jar:4.1.31.Final:compile -
> omitted for duplicate)
> [INFO] | | \- (io.netty:netty-transport:jar:4.1.31.Final:compile - omitted
> for duplicate)
> [INFO] | \- io.netty:netty-codec-http:jar:4.1.31.Final:compile
> [INFO] | \- (io.netty:netty-codec:jar:4.1.31.Final:compile - omitted for
> duplicate)
> [INFO] +- org.apache.activemq:artemis-amqp-protocol:jar:2.6.3:test
> [INFO] | +- org.apache.activemq:artemis-jms-client:jar:2.6.3:test
> [INFO] | | +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
> omitted for duplicate)
> [INFO] | | +- (org.apache.activemq:artemis-selector:jar:2.6.3:test -
> omitted for duplicate)
> [INFO] | | \-
> (org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:test -
> omitted for duplicate)
> [INFO] | +- org.apache.activemq:artemis-selector:jar:2.6.3:test
> [INFO] | | \- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | +- org.apache.activemq:artemis-core-client:jar:2.6.3:test
> [INFO] | | +- org.jgroups:jgroups:jar:3.6.13.Final:test
> [INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | | +-
> (org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test -
> omitted for duplicate)
> [INFO] | | +- org.apache.johnzon:johnzon-core:jar:0.9.5:test
> [INFO] | | +-
> (io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
> omitted for conflict with 4.1.31.Final)
> [INFO] | | +-
> (io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
> omitted for conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted
> for conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-codec:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.24.Final)
> [INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | +- org.apache.activemq:artemis-commons:jar:2.6.3:test
> [INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test -
> omitted for duplicate)
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | \- (commons-beanutils:commons-beanutils:jar:1.9.3:test - omitted
> for duplicate)
> [INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:test
> [INFO] | +- (org.apache.activemq:artemis-server:jar:2.6.3:test - omitted for
> duplicate)
> [INFO] | +- org.apache.activemq:artemis-journal:jar:2.6.3:test
> [INFO] | | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test -
> omitted for duplicate)
> [INFO] | | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | | +- (org.apache.activemq:artemis-native:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | | \- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | +- (org.apache.qpid:proton-j:jar:0.27.3:test - omitted for conflict
> with 0.30.0)
> [INFO] | +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] | \- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] \- org.apache.activemq:artemis-server:jar:2.6.3:test
> [INFO] +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test - omitted
> for duplicate)
> [INFO] +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] +- (org.apache.activemq:artemis-selector:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] +- org.apache.activemq:artemis-jdbc-store:jar:2.6.3:test
> [INFO] | +- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test -
> omitted for duplicate)
> [INFO] | +- (org.apache.activemq:artemis-commons:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | +- (org.apache.activemq:artemis-journal:jar:2.6.3:test - omitted
> for duplicate)
> [INFO] | \- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
> omitted for duplicate)
> [INFO] +- (org.apache.activemq:artemis-core-client:jar:2.6.3:test -
> omitted for duplicate)
> [INFO] +- org.apache.activemq:artemis-native:jar:2.6.3:test
> [INFO] | \- (org.jboss.logging:jboss-logging:jar:3.3.1.Final:test -
> omitted for duplicate)
> [INFO] +- (io.netty:netty-buffer:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] +- (io.netty:netty-transport:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] +- (io.netty:netty-codec-http:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] +- (io.netty:netty-common:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] +- (io.netty:netty-handler:jar:4.1.24.Final:test - omitted for
> conflict with 4.1.31.Final)
> [INFO] +-
> (io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.24.Final:test -
> omitted for conflict with 4.1.31.Final)
> [INFO] +-
> (io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.24.Final:test -
> omitted for conflict with 4.1.31.Final)
> [INFO] +- (io.netty:netty-codec:jar:4.1.24.Final:compile - scope updated
> from test; omitted for duplicate)
> [INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:test
> [INFO] | +- commons-logging:commons-logging:jar:1.2:test
> [INFO] | \- commons-collections:commons-collections:jar:3.2.2:test
> [INFO] +- commons-io:commons-io:jar:2.6:test
> [INFO] \-
> org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:test
> {noformat}
> You can see that e.g. netty-codec does not appear in a chain of compile
> scoped dependencies, because it is instead captured in the test dependencies.
> I'd expect that Embed-Dependency would still embed netty-codec into the
> bundle, because it is needed by the app itself, not just tests. This is not
> what happens, though.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)