-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSGi / bnd: Remove the self-Import of gson.annotations #2735
OSGi / bnd: Remove the self-Import of gson.annotations #2735
Conversation
based on google#2725 and bndtools/bnd#6220 (comment) append -noimport:=true to all exports which we do not want to re-import This avoids issues in OSGi environments where multiple versions of gson are deployed and com.google.gson.annotations causes wiring conflicts between these different versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I am still not completely sure what the 'correct' approach is (see the discussions you linked), but it is probably worth a try.
@eamonnmcmanus, what do you think?
One statement I discovered, which makes me think Source: https://bugs.eclipse.org/bugs/show_bug.cgi?id=183595#c7
I think Gson qualifies as a library bundle (as opposed to an OSGi based fully fledged application). I think the important statement is this:
This could be read e.g. like "I am fine that the package
This is different to OSGi based fully fledged applications (like Eclipse, AEM, Liferay). I will try to discuss this further with the bnd / OSGi developers, and maybe the result could be a recommendation / documentation improvement for this specific problem. |
Thanks, I really don't know anything about OSGi but I'm happy to go with whatever you decide after talking to the OSGi experts. |
@eamonnmcmanus thanks for your reply . @bjhargrave has approved this PR and he is THE OSGi expert and longtime bndtools committer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for doing all this!
Closes #2725
Purpose
Fixes a runtime issue in OSGi environments using multiple versions of GSON.
Description
Based on bndtools/bnd#6220 (comment) append
-noimport:=true
to all exports which we do not want to re-import.This will remove the package from the
Import-Package
instruction in the resultingMANIFEST.MF
This avoids issues in OSGi environments where multiple versions of gson are deployed and required by different consumers and
com.google.gson.annotations
causes wiring conflicts between these different gson versions.For further information about the
-noimport
check the bnd manual.Checklist
This is automatically checked by
mvn verify
, but can also be checked on its own usingmvn spotless:check
.Style violations can be fixed using
mvn spotless:apply
; this can be done in a separate commit to verify that it did not cause undesired changes.null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errorsMentioning @Marcono1234 since he was involved in the discussions.