0

Plugin version: 3.3.0

I am wondering how maven-bundle-plugin resolves the version from duplicated Export-Packages bundle, the following is from mvn -X debug output and seems like the plugin is using the version from the first bundle found.

-----------------------------------------------------------------------

[DEBUG] BND Classpath:

-----------------------------------------------------------------------

-classpath:\ D:\dev\m3repo\io\dropwizard\metrics\metrics-core\3.1.2\metrics-core-3.1.2.jar,\ D:\dev\m3repo\com\codahale\metrics\metrics-core\3.0.2\metrics-core-3.0.2.jar

-----------------------------------------------------------------------

MANIFEST.MF (io\dropwizard\metrics\metrics-core\3.1.2\metrics-core-3.1.2.jar)

Manifest-Version: 1.0 
Bnd-LastModified: 1430020731305 
Build-Jdk: 1.8.0_05 
Built-By: ryantenney 
Bundle-Description: Metrics is a Java library which gives you unparallel  ed insight into what your code does in        production. Metrics provi  des a powerful toolkit of ways to measure the behavior of critical     
    components in your production environment. 
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.html Bundle-ManifestVersion: 2 
Bundle-Name: Metrics Core 
Bundle-SymbolicName: io.dropwizard.metrics.core 
Bundle-Version: 3.1.2 
Created-By: Apache Maven Bundle Plugin 
Export-Package: com.codahale.metrics;uses:="org.slf4j,javax.management,sun.misc";version="3.1.2"
Implementation-Title: Metrics Core 
Implementation-Vendor-Id: io.dropwizard.metrics 
Implementation-Version: 3.1.2 
Import-Package: javax.management,org.slf4j;version="[1.6.0,2.0.0)",sun.m  isc;resolution:=optional 
Tool: Bnd-1.50.0

MANIFEST.MF (com\codahale\metrics\metrics-core\3.0.2\metrics-core-3.0.2.jar)

Manifest-Version: 1.0 
Bnd-LastModified: 1392597083041 
Build-Jdk: 1.7.0_51 
Built-By: coda 
Bundle-Description: Metrics is a Java library which gives you unparallel  ed insight into what your code does in     production. Metrics provi  des a powerful toolkit of ways to measure the behavior of critical     
    components in your production environment. 
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.html 
Bundle-ManifestVersion: 2 
Bundle-Name: Metrics Core 
Bundle-SymbolicName: com.codahale.metrics.core 
Bundle-Version: 3.0.2 
Created-By: Apache Maven Bundle Plugin 
Export-Package: com.codahale.metrics;uses:="org.slf4j,javax.management,s  un.misc";version="3.0.2" 
Implementation-Title: Metrics Core 
Implementation-Vendor-Id: com.codahale.metrics 
Implementation-Version: 3.0.2 
Import-Package: javax.management,org.slf4j;version="[1.6.0,2.0.0)",sun.m  isc;resolution:=optional 
Tool: Bnd-1.50.0

And the final output MANIFEST.MF for my bundle:

#-----------------------------------------------------------------------

[DEBUG] Final Manifest:
#-----------------------------------------------------------------------
Manifest-Version: 1.0
Bnd-LastModified: 1499834358907
Build-Jdk: 1.8.0_111
Built-By: ys03
Bundle-Description: MyBundle
Bundle-DocURL: http://my.bundle
Bundle-ManifestVersion: 2
Bundle-Name: MyBundle
Bundle-SymbolicName: com.foo.bar.myBundle
Bundle-Vendor: ysw
Bundle-Version: 1.0.0.11
Created-By: Apache Maven Bundle Plugin
Export-Package: com.foo.bar.myBundle;
Implementation-Version: 1.0.0.11 Build: dfaf45de3d27234d42fcc2841e06ccc8
 ed530f18 Timestamp: 2017-07-12 12:39:12
Import-Package:
 com.fasterxml.jackson.databind;version="[2.3.0,3.0.0)",
 org.joda.time.format;version="[2.1.0,3.0.0)",
 com.codahale.metrics;version="[3.1,4)",
 com.google.common.collect;version="[19.0,20)",
 org.apache.commons.codec.binary;version="[1.10,2)",
 org.apache.commons.lang3;version="[3.4,4)",
 org.slf4j;version="[1.7,2)",
Tool: Bnd-3.3.0.201609221906
#-----------------------------------------------------------------------

The final version for com.codahale.metrics is [3.1,4), I suppose it should be [3.0,4), please correct my understanding if I am wrong.

Thanks.

yswai1986
  • 263
  • 2
  • 8

1 Answers1

0

I would say the automatism uses the maven dependency you specified, and then it goes on to try resolution via the transitive dependencies. Something might be hidden in there that requires 3.1 .

Georg
  • 987
  • 8
  • 16