单元测试错误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>
相关推荐
libo_20257 小时前
HarmonyOS5 UI测试革命:基于ArkUI Inspector的组件精准定位策略
单元测试
libo_202510 小时前
HarmonyOS5 全设备覆盖:在DevEco Cloud上自动测试Phone+TV+Watch三端兼容性
单元测试
libo_202510 小时前
HarmonyOS5 端到端测试:从登录到支付的完整业务流程自动化验证
单元测试
libo_202510 小时前
反逆向测试:验证HarmonyOS5应用防反编译能力的测试方法
单元测试
libo_202510 小时前
10分钟上手DevEco Testing:编写你的第一个HarmonyOS5单元测试
单元测试
远方16091 天前
16-Oracle 23 ai-JSON-Relational Duality-知识准备
数据库·oracle·json
sc写算法2 天前
基于nlohmann/json 实现 从C++对象转换成JSON数据格式
开发语言·c++·json
酷爱码2 天前
Spring Boot项目中JSON解析库的深度解析与应用实践
spring boot·后端·json
多多*2 天前
微服务网关SpringCloudGateway+SaToken鉴权
linux·开发语言·redis·python·sql·log4j·bootstrap
不惑_2 天前
用 PyQt5 打造一个可视化 JSON 数据解析工具
开发语言·qt·json