单元测试错误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>
相关推荐
小吕学编程8 小时前
Jackson使用详解
java·javascript·数据库·json
双叶83611 小时前
(C语言)超市管理系统 (正式版)(指针)(数据结构)(清屏操作)(文件读写)(网页版预告)(html)(js)(json)
c语言·javascript·数据结构·html·json
呦呦彬1 天前
【问题排查】easyexcel日志打印Empty row!
java·开发语言·log4j
电商数据girl1 天前
酒店旅游类数据采集API接口之携程数据获取地方美食品列表 获取地方美餐馆列表 景点评论
java·大数据·开发语言·python·json·旅游
才知山高路远1 天前
Java - Junit框架
java·junit·log4j
还是鼠鼠1 天前
JMeter 教程:编写 GET 请求脚本访问百度首页
功能测试·jmeter·单元测试
bing_1582 天前
Spring MVC 根据请求头 (如 Accept) 怎么返回 JSON 或 XML 数据?
spring·json·mvc
alladmin2 天前
VSCode CMake工作流
log4j
半路_出家ren2 天前
python处理异常,JSON
python·json·异常处理
笨蛋不要掉眼泪2 天前
SpringAOP
java·数据库·spring·log4j