单元测试错误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 小时前
白盒测试用例的设计
自动化测试·软件测试·python·测试工具·职场和发展·单元测试·测试用例
电商API&Tina2 小时前
1688 拍立淘接口(item_search_img)测试与接入实战心得
java·大数据·前端·物联网·oracle·json
ZC跨境爬虫6 小时前
海南大学交友平台开发实战 day11(实现性别图标渲染与后端数据关联+Debug复盘)
前端·python·sqlite·html·json
被放养的研究生8 小时前
vscode-settings.json
ide·vscode·json
好大哥呀8 小时前
单元测试自动化的流程
运维·单元测试·自动化
SuperEugene9 小时前
Vue3 配置驱动表单:JSON配置+渲染引擎,快速搭建复杂表单|配置驱动开发实战篇
驱动开发·json
敲上瘾9 小时前
大模型接入从入门到实战:API/SDK/本地部署/Claude Code 路由全解析
人工智能·深度学习·机器学习·json·aigc·claude
见山是山-见水是水9 小时前
鸿蒙flutter第三方库适配 - JSON格式化工具应用
flutter·华为·json·harmonyos
__zRainy__10 小时前
Node.js 日志选型指南:Winston vs Log4js 全方位对比与实战
node.js·log4j·winston
Dontla10 小时前
JWT认证流程(JSON Web Token)
前端·数据库·json