Hi,
GSON release 2.8.0 JAR published to/available from maven repository is not an OSGI bundle; MANIFEST file doesn't contain OSGI specific info.
2.8.0 JAR MANIFEST.MF contains
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: jwilson
Created-By: Apache Maven 3.2.3
Build-Jdk: 1.8.0_92
where as 2.7.0 JAR MANIFEST.MF contains
Manifest-Version: 1.0
Bundle-Description: Gson JSON library
Bundle-SymbolicName: com.google.gson
Archiver-Version: Plexus Archiver
Built-By: inder
Bnd-LastModified: 1465948546904
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6, JavaSE-1.7,
JavaSE-1.8
Bundle-Vendor: Google Gson Project
Import-Package: com.google.gson.annotations
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.6))"
Bundle-ContactAddress: https://github.com/google/gson
Tool: Bnd-3.1.0.201512181341
Export-Package: com.google.gson;uses:="com.google.gson.reflect,com.goo
gle.gson.stream";version="2.7.0",com.google.gson.annotations;version=
"2.7.0",com.google.gson.reflect;version="2.7.0",com.google.gson.strea
m;version="2.7.0"
Bundle-Name: Gson
Bundle-Version: 2.7.0
Created-By: 1.8.0_91 (Oracle Corporation)
Build-Jdk: 1.8.0_91
Regards,
Rakesh.A
Please send a pull request @iamrakesh
Is there any reason that the manifest generated through the bnd-maven-plugin[1] isn't getting used in the released JAR? I'm not overly familiar with all that GSON does for their development practice, but I have noticed that there are certain versions of gson do not have a manifest at all (such as the above).
[1] - https://github.com/google/gson/blob/master/gson/pom.xml#L34-L47
If I understand the documentation for 'bnd-maven-plugin', available at https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin correctly; this plugin generates 'MANIFEST.MF' with all OSGI information and places it in output directory.
If we want to use this manifest file, we've to change the way JAR plugin is configured, See - https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin#important-note
It seems GSON Jar is generated with the generated MANIFEST some times and sometimes not.
Yes, you would have to update the maven-jar-plugin to always use the manifest created by the maven-bnd-plugin. I'm not sure of a situation where you wouldn't want it, but I might not be aware of other consumers that this would influence...
+1 for getting this issue resolved.
馃憤
+1 for this issue. I exclusively use GSON in osgi environment...
It seems the 2.8.1-SNAPSHOT now has OSGi headers back, right?

it also seems ok if installed into Karaf

It seems this check-in makes it work.
Though I have one observation on the generated MANIFEST.MF -
'Import-Package' manifest entry is not correct.
Most helpful comment
+1 for getting this issue resolved.