java - 春季启动时的“为 gson 覆盖托管版本 2.8.1”警告会有多糟糕?怎么可能避免?
问题描述
我在我的父项目中使用 spring-boot。在一个子项目中,我打算使用 Gson 库。当我将它添加到子项目时
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
我收到了这个警告:
Overriding managed version 2.8.1 for gson
删除后<version>
,我收到此警告:
The managed version is 2.8.1 The artifact is managed in org.springframework.boot:spring-boot-dependencies:1.5.7.RELEASE
pom
既然它已经存在于 spring-boot 中,为什么在我从无法导入Gson
到我的类中删除依赖项之后呢?我应该如何将这个库与 spring-boot 一起使用?
编辑
我尝试过了
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
在我的spring-boot-starter-web
, spring-boot-starter-tomcat
, spring-boot-starter-logging
, spring-boot-starter-data-jpa
and spring-boot-starter-cache
(我所有的 spring-boot 依赖项),但它没有工作。
使用原始dependency
标签,我成功地在 Java 中使用了这个依赖项,但我的问题是忽略这个警告有多糟糕?使用不同的 Gson 版本依赖项会出现什么问题?
解决方案
推荐阅读
- android - 后台粘性并发标记扫描GC sqlite数据库的无限循环
- camunda - 自定义白名单模式配置
- html - Trying to get a page layout to work with Google mobile-friendly tests
- for-loop - 将 For 循环转换为 While
- android - 如何在android中编写'#'并将其作为值
- asp.net - How to check rows are true in grid view databound event?
- node.js - 是否可以在 post 方法中更新 mongodb 集合(使用 Mongoose)?
- django - Django 模板未在容器中执行且日志中未显示错误
- android - 我如何将多个数据保存到 Firebase 实时数据库中
- google-cloud-platform - 是否可以通过浏览器中的 JavaScript 连接到 Google IOTCore