Unable to use com.google.code.gson class in aem
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);



