单元测试错误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 小时前
JSON 零基础到资深全体系教程
java·json
五阿哥永琪1 天前
MySQL中操作json的函数!
数据库·mysql·json
用户7783366132111 天前
SERP API JSON Schema 演进版本管理实战
json·api
栈溢出的浪漫2 天前
Python单元测试框架覆盖率-Coverage
python·单元测试·工具·覆盖率·coverage
IT小盘2 天前
14-让大模型稳定输出JSON-Prompt约束与结构化输出
windows·json·prompt
赵庆明老师3 天前
Vben精讲:21-详解web-antd:tsconfig.json
前端·json·vim
5系暗夜孤魂z3 天前
优雅的.net REST API之FastEndpoints
log4j·.net
名字还没想好☜3 天前
Go 表驱动测试实战:用 t.Run 子测试组织可维护的单元测试
golang·单元测试·log4j·go·testing
Dr.kangder4 天前
嵌入式软件单元测试:从理论到实践
架构·单元测试·嵌入式·测试覆盖率
老白干4 天前
jjwt 0.9.1 在 JDK 11+ 上的两个“坑”与完整解决方案
java·python·log4j