单元测试错误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>
相关推荐
haven-85235 分钟前
AI Agent 生态核心概念详解:Agent、MCP、Skill 与 JSON-RPC
人工智能·rpc·json
_xaboy1 小时前
开源Vue组件FormCreate通过 JSON 生成TinyVue表单
前端·vue.js·低代码·开源·json·表单设计器
yumgpkpm2 小时前
华为HUAWEI昇腾910B下千问Qwen3.6-27B在的推理加速实践
sql·华为·langchain·json·ai编程·ai写作·gpu算力
SilentSamsara4 小时前
文件与数据处理:CSV/JSON/Excel/Parquet 高效操作与内存优化
开发语言·python·青少年编程·性能优化·json·excel
lzhdim15 小时前
SQL 入门 17:MySQL 数据类型:从字符串到 JSON 的全面解析
数据库·sql·mysql·json
无风听海17 小时前
JSON Web Token(JWT)完全指南
java·前端·json
誰能久伴不乏1 天前
Qt C++ 解析 JSON 完全指南:从核心概念到工业级实战
c++·qt·json
空空潍1 天前
使用Coze工作流API实现结构化输出
json·工作流·coze
神奇的代码在哪里1 天前
【单机离线版】excel转json软件,纯HTML+JS零依赖实现Excel转JSON工具,一个index.html搞定所有转换!
html·json·excel·excel转json·xlsx转json·xls转json
爱滑雪的码农2 天前
Java基础二十:JSON 数据解析、对象与 JSON 互转逻辑
json