单元测试错误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>
相关推荐
数据狐(Datafox)15 分钟前
1688商品列表API接口解析(附 JSON 样例)
java·开发语言·数据库·爬虫·json
j7~1 天前
【Linux网络加餐】(篇六)网络版计算器(上):模板方法模式、序列化与 JSON
linux·c++·json·序列化·反序列化·网络版计算机
CAE虚拟与现实1 天前
什么是浏览器冒烟测试
单元测试·测试·冒烟测试·回归测试
梦帮科技1 天前
Next.js 16 模块化单体实战:App Router、领域模块与 Route Handler 分层
css·数据结构·链表·正则表达式·node.js·json·html5
Wang's Blog2 天前
Java框架快速入门: Spring Security+OAuth2之JWT核心概念与实战
java·spring·log4j
蓝悦无人机2 天前
LangChain v1.0 系列教程——第2章 工具系统
langchain·json·装饰器模式·pydantic
Lyra_Infra2 天前
从一段错误 JSON 说起:Policy、Role 与 IAM
后端·json·aigc
羑悻的小杀马特2 天前
数据织网者:Jsoncpp库深度解析——从C++原生JSON处理到工程级数据交互实战全攻略
c++·json·交互·jsoncpp·原生库
代码什么用2 天前
JSON一文速通
java·json
写后端的胖头鱼2 天前
一文学会单元测试之----Junit
junit·单元测试