Hi all,
I am trying build my project with new Uber jar 6.5.17.
I am getting
Java.lang.NoSuchMethodError: com.google.gson.internal.bind.ObjectaTyperAdapter.getFactory.
In the testing phase.
We have added the Gson(2.8.5) dependency to the core POM file but still getting same error.
It was working file with 6.5.10 Uber jar.
Anyone knows how to fix it
Solved! Go to Solution.
Make sure you added the Gson dependency before the Uber Jar. At least in the core pom.xml
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
</dependency>
Make sure you added the Gson dependency before the Uber Jar. At least in the core pom.xml
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
</dependency>
It resolved my issue.
Just for learning why we need to add Gson dependency before Uber?
Gson is also present in Uber Jar. But this gson is not scoped for unit tests(may be). When you add extra maven dependency for the unit test it needs to place before Uber Jar. Because you want to initialize the Gson from the Gson maven dependency for classpath priority.
I faced the same issue, but in my case the dependency was org.apache.poi and after coming across your issue-answer, I was able to fix it.
Thanks so much @Sady_Rifat for the answer.
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies