单元测试错误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>
相关推荐
爱的叹息3 小时前
Log4j Properties 配置项详细说明
junit·单元测试·log4j
程序员小远15 小时前
接口测试和单元测试详解
自动化测试·软件测试·python·测试工具·单元测试·测试用例·接口测试
是席木木啊16 小时前
SpringBoot集成WebSocket,单元测试执行报错
spring boot·websocket·单元测试
隐形喷火龙21 小时前
搭建TypeScript单元测试环境
javascript·typescript·单元测试
沉迷...2 天前
详解.vscode 下的json .vscode文件夹下各个文件的作用
ide·vscode·json
猿周LV2 天前
JMeter 安装及使用 [软件测试工具]
java·测试工具·jmeter·单元测试·压力测试
程序员总部2 天前
如何在IDEA中高效使用Test注解进行单元测试?
java·单元测试·intellij-idea
聪明的墨菲特i2 天前
SQL进阶知识:九、高级数据类型
xml·数据库·sql·mysql·json·空间数据类型
AAA顶置摸鱼2 天前
使用 Pandas 进行多格式数据整合:从 Excel、JSON 到 HTML 的处理实战
json·excel·pandas
冰^2 天前
MySQL VS SQL Server:优缺点全解析
数据库·数据仓库·redis·sql·mysql·json·数据库开发