Skip to content
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

Manifest OSGi Import-Packages should not contain "com.google.gson.internal" #335

Open
Hannu1 opened this issue Apr 4, 2023 · 0 comments

Comments

@Hannu1
Copy link

Hannu1 commented Apr 4, 2023

Has this project moved? I can't seem to find the latest changes. Latest release in maven central is 3.0.4-jdk17.

This issue relates to version 3.0.4-jdk17.

In FSTConfiguration class android configuration uses Class.forName("com.google.gson.internal.LinkedTreeMap") and Class.forName("com.google.gson.internal.LinkedHashTreeMap").
maven-bundle-plugin probably notices these and adds "com.google.gson.internal" as an Import-Package in MANIFEST.MF. Manifest also contains "DynamicImport-Package: *" so this import is not necessary. Other option could be to declare the import optional, since it is only for android.

Fix could be to change pom.xml line:
<Import-Package>*</Import-Package>
to
<Import-Package>!com.google.gson.internal.*,*</Import-Package>

or if you would like to make it optional:
<Import-Package>com.google.gson.internal.*;resolution=optional,*</Import-Package>

Also maven-bundle-plugin shouldn't be a compile dependency and should be removed from "dependencies" element. (Separate issue #328)

EDIT: Added .* to the exclusion example and added the optional example. Also cleaned up the text a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant