单元测试错误Found multiple occurrences of org.json.JSONObject on the class path

编译错误

单元测试启动错误

bash 复制代码
Found multiple occurrences of org.json.JSONObject on the class path:

	jar:file:/D:/developsoft/maven/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
	jar:file:/D:/developsoft/maven/repository/org/json/json/20131018/json-20131018.jar!/org/json/JSONObject.class

You may wish to exclude one of them to ensure predictable runtime behavior

分析:依赖冲突

解决办法:排除依赖

xml 复制代码
 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
相关推荐
ZhongruiRao4 小时前
Springboot+PostgreSQL+MybatisPlus存储JSON或List、数组(Array)数据
spring boot·postgresql·json
华农第一蒟蒻5 小时前
Java中JWT(JSON Web Token)的运用
java·前端·spring boot·json·token
胡耀超6 小时前
知识图谱入门——8: KG开发常见数据格式:OWL、RDF、XML、GraphML、JSON、CSV。
xml·json·知识图谱·csv·owl·graphml·gml
回眸&啤酒鸭7 小时前
【回眸】Tessy 单元测试软件使用指南(四)常见报错及解决方案与批量初始化的经验
单元测试·tessy
x-cmd10 小时前
[241005] 14 款最佳免费开源图像处理库 | PostgreSQL 17 正式发布
数据库·图像处理·sql·安全·postgresql·开源·json
先知demons17 小时前
js将对象的键和值分别归纳进对象,并将多层对象转化成数据的方法
javascript·vue.js·json
Midsummer啦啦啦1 天前
Python字符串转JSON格式指南
开发语言·python·json
Iam傅红雪1 天前
mock数据,不使用springboot的单元测试
spring boot·后端·单元测试
前端 贾公子1 天前
Express内置的中间件(express.json和express.urlencoded)格式的请求体数据
中间件·json·express
月光code1 天前
SLF4J报错log4j又报错
单元测试·log4j