码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot中pom引入gson异常

时间:2019-08-20 15:27:06      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:版本   cal   compile   depend   google   file   art   异常   enc   

 在pom中引入gson依赖,启动spring boot项目中报错

Description:

An attempt was made to call the method com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; but it does not exist. Its class, com.google.gson.GsonBuilder, is available from the following locations:

    jar:file:/D:/work/code/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/com/google/gson/GsonBuilder.class

It was loaded from the following location:

    file:/D:/work/code/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
开始以为jar包冲突,查询各个pom发现并没有重复依赖,最后将2.2.4版本换为2.6版本后启动正常

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6</version>
<!--<scope>compile</scope>-->
</dependency>

SpringBoot中pom引入gson异常

标签:版本   cal   compile   depend   google   file   art   异常   enc   

原文地址:https://www.cnblogs.com/cat-fish6/p/11383025.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!