单元测试错误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>
相关推荐
代码or搬砖39 分钟前
SpringMVC常用注解
log4j
风华浪浪1 小时前
python 基础之 jsonpatch 用于对 JSON 文档的局部更新操作
linux·python·json
aloha_78913 小时前
联易融测开面试准备
java·python·面试·单元测试
n***265621 小时前
MySQL JSON数据类型全解析(JSON datatype and functions)
android·mysql·json
R***623121 小时前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
老李头喽1 天前
走进单元测试
java·单元测试
万象.1 天前
高并发服务器组件单元测试&集成测试&系统测试
服务器·单元测试·集成测试
一缕猫毛2 天前
JUnit单元测试
junit·单元测试
阿巴~阿巴~2 天前
自定义协议设计与实践:从协议必要性到JSON流式处理
服务器·网络·网络协议·json·操作系统·自定义协议
最笨的羊羊3 天前
Flink CDC系列之:JSON 序列化器JsonRowDataSerializationSchemaUtils
json·flink cdc系列·serialization·json 序列化器·rowdata·schemautils