单元测试错误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>
相关推荐
1314lay_100717 分钟前
使用HTTP接口,对接外围系统,封装调用跟推送类和动态转换json,动态编程和动态调用函数
http·json·abap
程序员二黑3 小时前
告别硬编码!5个让Web自动化脚本更稳定的定位策略
面试·单元测试·测试
zero13_小葵司4 小时前
基于Springboot的DDD实战(不依赖框架)
java·spring boot·log4j
老坛程序员14 小时前
抓包解析MCP协议:基于JSON-RPC的MCP host与MCP server的交互
人工智能·网络协议·rpc·json·交互
小熊出擊19 小时前
[pytest] autouse 参数:自动使用fixture
python·测试工具·单元测试·自动化·pytest
ZoeLandia1 天前
Vue 项目 JSON 在线编辑、校验如何选?
前端·vue.js·json
知识分享小能手1 天前
React学习教程,从入门到精通,React 单元测试:语法知识点及使用方法详解(30)
前端·javascript·vue.js·学习·react.js·单元测试·前端框架
测试老哥3 天前
软件测试之单元测试详解
自动化测试·软件测试·python·测试工具·职场和发展·单元测试·测试用例
lichong9513 天前
【大前端++】Android studio Log日志高对比度配色方案
android·java·前端·json·android studio·大前端·大前端++
加菲猫8603 天前
Apache Log4j2 lookup JNDI 注入漏洞(CVE-2021-44228)
log4j·apache