amaembo / jsr-305

Automatically exported from code.google.com/p/jsr-305
15 stars 14 forks source link

Remove version in Export-Packages in OSGi manifest #31

Open kwin opened 7 years ago

kwin commented 7 years ago

Right now the maven-bundle-plugin will automatically add the project version for each of the exported packages: https://github.com/amaembo/jsr-305/blob/master/ri/pom.xml#L94. This was changed with version 3.0.1. That is a problem when using this in an OSGi context, because the using bundles automatically have a dependency to e.g. javax.annotation in version [3,4). That is usually not resolvable as those annotations are not deployed in an OSGi container. But since javax.annotation is part of the JRE your system bundle exports the package javax.annotation in a JRE-specific version. Since the annotations are usually not required at run time I would recommend to not explicitly specify a version in the Export-Packages header and through this allow this dependency to be resolved by the system bundle.

kwin commented 7 years ago

Newer versions of the maven-bundle-plugin should only give a version for exported packages in case there has been an explicit version information given in the package-info.java (compare with https://issues.apache.org/jira/browse/FELIX-5172 and http://www.mail-archive.com/osgi-dev@mail.osgi.org/msg01514.html).