com.google.gson.internal -- Cannot be resolved

Avatar

Avatar

sathyaprakasha2

Avatar

sathyaprakasha2

sathyaprakasha2

11-06-2020

Hi Team,

 

How to add embed-dependency in bnd-maven-plugin. wanna add com.google.gson

 

com.google.gson.internal -- Cannot be resolved

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

Veena_Vikram
MVP

11-06-2020

Which version of AEM are you using @sathyaprakasha2 . In most of the latest version of AEM , google gson  bundle should be available in the felix console already. Can you check /system/console/depfinder and search for the archetype you want to install ? 

I have 6.5 version and I already have gson in my felix console. PFB the screenshot.  You can copy the dependency from here and add it in the pom.xml files under <dependencyManagement><dependencies> section.

 

 1) Add below dependency on your main pom.xml

<dependency>
	<artifactId>gson</artifactId>
	<version>2.8.5</version>
	<groupId>com.google.code.gson</groupId>
	<scope>provided</scope>
</dependency>

2) Add the below in your core/pom.xml

<dependency>
	<artifactId>gson</artifactId>
	<groupId>com.google.code.gson</groupId>
</dependency>

 

dep1.JPG

 

If it is not available in your Felix console , then you can treat it as a third party bundle and follow the article mentioned by @Ankur_Khare 

 

Hope this helps 🙂

Answers (3)

Answers (3)

Avatar

Avatar

surabhikatiyar

Employee

Avatar

surabhikatiyar

Employee

surabhikatiyar
Employee

11-06-2020

In maven-bundle-plugin, <wrapImportPackage>;</wrapImportPackage>  would add all your dependencies as resources in the generated jar file and configure the bundle classpath for you.
bnd-maven-plugin does not use instructions in the POM. You have to do that in bnd file. in the link provided below will show you an example of -includeresource instruction and how to set your bundle classpath.

 

Please check the document for more information:

 

1. https://help.liferay.com/hc/en-us/articles/360018162491-Resolving-Third-Party-Library-Package-Depend...

Avatar

Avatar

davidjgonzalezzzz

Avatar

davidjgonzalezzzz

davidjgonzalezzzz

17-02-2021

You're supposed to be directly referencing anything in the com.google.gson.internal package... that's why it's called "internal". 

See the big warning on the GSON JavaDocs site for these internal packages [1] that reads: Do NOT use any class in this package as they are meant for internal use in Gson. Infact, this package is no longer exported at all in later versions of GSON.

 

The fix is to update your code to depend on Gson's public API space.

 

[1] https://javadoc.io/doc/com.google.code.gson/gson/1.7.2/com/google/gson/internal/package-summary.html

Avatar

Avatar

Ankur_Khare

MVP

Avatar

Ankur_Khare

MVP

Ankur_Khare
MVP

11-06-2020