单元测试错误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>
相关推荐
aiotto资源分享7 小时前
Python 写 JSON 文件,程序中途退出会留下什么?
java·python·json·jsondecodeerror
一起学安全技术1 天前
拆大模型 10|结构化输出:让模型返回数据,而不是一段话
人工智能·语言模型·json
用户298698530141 天前
在 Python 中把 Word 文档转换为 JSON 的三种实现方式
python·json·api
FRing033 天前
vue2干货总结10(json-server、vant-ui、postcss插件、axios二次封装、图形验证码、toast轻提示)
开发语言·前端·vue.js·ui·json·vue2·postcss
用户298698530143 天前
使用 Python 将 JSON 转换为 Word 文档的实践指南
python·json·api
lw_zhang11013 天前
爆肝一个月,Java 从入门到精通39 - 使用Log4j
java·单元测试·log4j
九英里路4 天前
protobuf快速上手
网络·c++·中间件·json·谷歌·序列化·protobuf
wuyk5554 天前
Spider-第09讲-三格式落盘CSV-Excel-JSON
爬虫·python·json·excel
wuyk5555 天前
Spider-第07讲-JSON接口与正则提取
爬虫·python·json
码间留白6 天前
从怀疑到真香——AI 重构代码后,我不再追求“最合适”,而是做好这两件事:测试和优化
单元测试·ai编程·代码质量·工程效率·ai重构代码