单元测试错误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>
相关推荐
.切切切 切萝卜2 小时前
【Content-Type详解、Postman中binary格式、json格式数据转原始二进制流等】
json
伯牙碎琴8 小时前
二、Spring Framework基础:IoC(控制反转)和DI(依赖注入)
java·spring·log4j
33三 三like1 天前
软件测试:1、单元测试
数据库·sqlserver·log4j
_风中无我。2 天前
Spring的过滤器获取请求体中JSON参数,同时解决Controller获取不到请求体参数的问题。
java·spring·json
whisperrr.2 天前
【JavaWeb12】数据交换与异步请求:JSON与Ajax的绝妙搭配是否塑造了Web的交互革命?
前端·ajax·json
子非衣2 天前
MySQL修改JSON格式数据示例
android·mysql·json
Zero_pl2 天前
黑盒测试、白盒测试、单元测试、集成测试、系统测试、验收测试的区别与联系
单元测试·集成测试
风与沙的较量丶2 天前
单元测试方法的使用
单元测试·log4j
odoo中国3 天前
Part 3 第十二章 单元测试 Unit Testing
单元测试·软件工程
Zero_pl3 天前
单元测试的策略有哪些,主要包括什么?
单元测试