单元测试错误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>
相关推荐
Philtell1 天前
Ubuntu22.04TLS VS Code配置setting.json
json
databook1 天前
【总结整理】软件测试的反模式
单元测试·测试
Knight_AL1 天前
Maven 生命周期详解(validate → deploy)
java·log4j·maven
REDcker1 天前
AIGCJson 库介绍与使用指南
c++·json·aigc·c
lingzhilab1 天前
零知IDE——零知ESP32 + INA219电流传感器实现18650锂电池智能充放电监测系统
ide·单片机·json
全栈前端老曹1 天前
【包管理】npm最常见的10大问题故障和解决方案
前端·javascript·rust·npm·node.js·json·最佳实践
岁岁种桃花儿1 天前
Spring Boot核心插件全解析(官方+第三方,附使用场景)
log4j·springboot·插件
韩师学子--小倪2 天前
fastjson与gson的toString差异
java·json
l***21782 天前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
牛马1112 天前
ios swift处理json数据
ios·json·swift