Jiri Daněk created FELIX-5993:
---------------------------------
Summary: 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
Attachments: pom.xml
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)