单元测试错误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>
相关推荐
njsgcs2 天前
json转excel python pd
python·json·excel·pd
代码搬运媛2 天前
【架构相关】tsconfig.json 与 tsconfig.node.json、tsconfig.app.json 的关系和作用
node.js·json
ThreeAu.2 天前
pytest 实战:用例管理、插件技巧、断言详解
python·单元测试·pytest·测试开发工程师
程序员二黑3 天前
Selenium元素定位总失败?这8种定位策略你必须掌握
单元测试·测试·ab测试
卓码软件测评3 天前
第三方课题验收测试机构:【API测试工具Apifox使用指南】
功能测试·测试工具·单元测试·压力测试·可用性测试
兮动人3 天前
Java 单元测试中的 Mockito 使用详解与实战指南
java·开发语言·单元测试
安冬的码畜日常4 天前
【JUnit实战3_01】第一章:JUnit 起步
测试工具·junit·单元测试
程序员二黑4 天前
自动化测试入门:从零开始搭建你的第一个WebUI项目
单元测试·测试·ab测试
aerror4 天前
json转excel xlsx文件
开发语言·python·json