I am trying to use GsonBuilder from com.google.code.gson so I added below depdency in
main/pom.xml
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>
core/pom.xml
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
Also I imported gson package in "bnd-maven-plugin" plugin as below
core/pom.xml
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,!com.google.gson.*,*
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
I am including this in one of my servlet,
Gson gson = new GsonBuilder().create();
Climate climateRes = gson.fromJson(climateResponse, Climate.class);
Solved! Go to Solution.
Views
Replies
Total Likes
It worked after removing ! and import package. Thanks for your input.
But still I dont see Gson (com.google.gson) bundle not appearing in system/console. But my servlet code is working fine. I wonder how it is working. I tried to search this "com.google.gson" java package in http://localhost:4502/system/console/depfinder and found below details,
My bundle is also listed. but my POM file have below 2.10.1 but I see 2.8.9 version. I am really confused who provided this version.
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>test</scope>
</dependency>
It worked after removing ! and import package. Thanks for your input.
But still I dont see Gson (com.google.gson) bundle not appearing in system/console. But my servlet code is working fine. I wonder how it is working. I tried to search this "com.google.gson" java package in http://localhost:4502/system/console/depfinder and found below details,
My bundle is also listed. but my POM file have below 2.10.1 but I see 2.8.9 version. I am really confused who provided this version.
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>test</scope>
</dependency>
@Mario248 We hope the AEM community has been beneficial to you. We look forward to your return as either a learner or a mentor. The community is enriched by SMEs like you. Please encourage your AEM peers to also participate. Happy AEM learning!
Views
Replies
Total Likes
Hello @Mario248 ,
Please check this thread, https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/upgrading-uber-jar-from-ae...
Try with put the dependency just before the uber jar in core pom.xml
Views
Likes
Replies
Views
Likes
Replies