[
https://issues.apache.org/jira/browse/FELIX-3630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435161#comment-13435161
]
Stuart McCulloch commented on FELIX-3630:
-----------------------------------------
The attached pom.xml has an additional execution of bundle:manifest which is
tied to the 'process-classes' phase:
{code}
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
{code}
This ends up creating a first-pass manifest under
target/classes/META-INF/MANIFEST.MF which exports the package using the bundle
version. The version appears to be added to the export by bnd, it isn't in the
Export-Package instruction generated by the bundle plugin during this execution
(see mvn clean process-classes -X). This is likely down to the slightly
different approach taken by bundle:manifest (which analyzes an existing
jar/directory using instructions as a guide) and bundle:bundle (which builds a
fresh bundle based on the classpath and a set of instructions) - it looks like
bnd's Builder takes package-level packageinfo versions into account, but bnd's
Analyzer doesn't.
After this extra execution has completed the bundle packaging lifecycle kicks
in and builds the bundle - once again mvn -X suggests that the bundle plugin
doesn't add any specific versions to the default instructions, but the manifest
we get back from bnd has the import range based on the interim manifest
generated previously (with exports versioned using the bundle-version).
However, the export now uses the packageinfo version.
I've tested this project with the latest maven-bundle-plugin 2.4.0-SNAPSHOT and
the incorrect versions no longer appear, so it looks like this has been fixed
in trunk.
As a workaround for 2.3.7 remove the above explicit execution of
bundle:manifest (it is not required when you use bundle packaging) and you
should get the expected results.
> Packages exported by bundle are (re)-imported with incorrect version
> --------------------------------------------------------------------
>
> Key: FELIX-3630
> URL: https://issues.apache.org/jira/browse/FELIX-3630
> Project: Felix
> Issue Type: Bug
> Components: Maven Bundle Plugin
> Affects Versions: maven-bundle-plugin-2.3.7
> Reporter: Michael Taeschner
> Attachments: importTest.zip
>
>
> Packages exported by bundle are (re)-imported with incorrect version using
> the bundle version instead of the package version.
> I have created an example where the bundle is version 1.2.0-SNAPSHOT and the
> package-version of the exported package is 1.0.0 (via *packageinfo* file)
> Resulting Manifest:
> Manifest-Version: 1.0
> Bnd-LastModified: 1345038828923
> Build-Jdk: 1.6.0_31
> Built-By: u056801
> Bundle-Description: maven-bundle-plugin Import Package Test
> Bundle-ManifestVersion: 2
> Bundle-Name: Imports Test
> Bundle-SymbolicName: com.mitaes.imports
> Bundle-Version: 1.2.0.SNAPSHOT
> Created-By: Apache Maven Bundle Plugin
> Export-Package: com.mitaes.service;version="1.0.0"
> Import-Package: com.mitaes.service;version="[1.2,2)"
> Tool: Bnd-1.50.0
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira