单元测试错误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>
相关推荐
python_chai1 分钟前
Django核心知识点全景解析
python·json
程序猿小D2 小时前
第25节 Node.js 断言测试
后端·node.js·log4j·编辑器·vim·apache·restful
子正18 小时前
C环境下更简洁的cJSON辅助函数
json
远方16091 天前
18-Oracle 23ai JSON二元性颠覆传统
数据库·oracle·json
浮生若梦l1 天前
在 Spring Boot 项目里,MYSQL中json类型字段使用
spring boot·mysql·json
libo_20252 天前
HarmonyOS5 UI测试革命:基于ArkUI Inspector的组件精准定位策略
单元测试
libo_20252 天前
HarmonyOS5 全设备覆盖:在DevEco Cloud上自动测试Phone+TV+Watch三端兼容性
单元测试
libo_20252 天前
HarmonyOS5 端到端测试:从登录到支付的完整业务流程自动化验证
单元测试
libo_20252 天前
反逆向测试:验证HarmonyOS5应用防反编译能力的测试方法
单元测试
libo_20252 天前
10分钟上手DevEco Testing:编写你的第一个HarmonyOS5单元测试
单元测试