单元测试错误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>
相关推荐
不吃香菜学java4 小时前
苍穹外卖-菜品分页查询
数据库·spring boot·tomcat·log4j·maven·mybatis
CSharp精选营5 小时前
.NET对象转JSON,到底有几种方式?
c#·json·.net·newtonsoft·对象转换·utf8json
不吃香菜学java5 小时前
苍穹外卖-新增菜品代码开发
spring boot·spring·servlet·log4j·maven·mybatis
淼_@淼6 小时前
python-json
前端·python·json
Java面试题总结7 小时前
Junit到Springboot单元测试
spring boot·junit·单元测试
sxhcwgcy8 小时前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
Bear on Toilet8 小时前
HTTP + JSON 接口调用清单总结
网络协议·http·json
测试199810 小时前
单元测试、系统测试、集成测试的区别是什么?
自动化测试·软件测试·测试工具·单元测试·测试用例·集成测试·安全性测试
电商API&Tina1 天前
【电商API接口】开发者一站式电商API接入说明
大数据·数据库·人工智能·云计算·json
消失的旧时光-19431 天前
Android 面试高频:JSON 文件、大数据存储与断电安全(从原理到工程实践)
android·面试·json