单元测试错误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>
相关推荐
张小洛4 小时前
Spring 常用类深度剖析(工具篇 05):Assert:用断言代替 if-throw,代码更清爽
spring·log4j·参数校验·validate·assert·spring 常用类·代码简化
星空椰6 小时前
从零到实战:一套完整的 Python 爬虫技术体系(requests + BeautifulSoup + 正则 + JSON)
爬虫·python·json·beautifulsoup
A__tao13 小时前
JSON 转 Proto 工具(支持嵌套与注释解析)
json
汽车仪器仪表相关领域17 小时前
Kvaser Memorator Professional 5xHS CB:五通道CAN FD裸板记录仪,赋能多总线系统集成测试的旗舰级核心装备
大数据·网络·人工智能·单元测试·汽车·集成测试
薛定猫AI21 小时前
【深度解析】DeepSeek V4 + Cloud Code:构建低成本、高吞吐的混合 AI 编码工作流
人工智能·log4j
A__tao1 天前
JSON 转 Java 实体类工具(支持嵌套与注释解析)
java·python·json
测试员周周1 天前
【AI测试功能2】AI功能测试的“不可确定性“难题与应对思路:从精确断言到统计判定的完整方案
大数据·人工智能·python·功能测试·测试工具·单元测试·测试用例
迷路爸爸1801 天前
VSCode / Cursor 中 LaTeX Workshop 的 settings.json 配置:编译与 SyncTeX 跳转
ide·vscode·json·latex
卷卷说风控1 天前
【卷卷观察】Claude Code 换脑子:DeepSeek V4 Pro 让你的 AI 编程便宜17倍
log4j
吴声子夜歌2 天前
Node.js——JSON-Server轻量级RESTful API
node.js·json·restful·json-server