单元测试错误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>
相关推荐
云动雨颤28 分钟前
Python单元测试入门:3个核心断言方法,帮你快速定位代码bug
python·单元测试
CodeCraft Studio3 小时前
Excel处理控件Aspose.Cells教程:使用 Python 将 Pandas DataFrame 转换为 Excel
python·json·excel·pandas·csv·aspose·dataframe
Suresoft China4 小时前
软件测试|STATIC 代码静态验证工具 C/C++ 工具链设置指南
c++·单元测试·静态测试·测试覆盖率·static·代码覆盖率·工具链设置
en-route6 小时前
深入理解 MDC(Mapped Diagnostic Context):日志记录的利器
java·log4j
敬业小码哥20 小时前
记一次:mysql的json及json数组使用组合使用
数据库·mysql·json
一键三联啊20 小时前
BSON 和 JSON 的区别
json
黑客飓风1 天前
从基础功能到自主决策, Agent 开发进阶路怎么走?
面试·log4j·bug
itppxie1 天前
Simulink中使用Test sequence单元测试
单元测试
黑客飓风2 天前
Bug排查日记:从崩溃到修复的实战记录
log4j·bug
泛联新安2 天前
如何根据项目需求选择合适的软件测试工具?iUnit智能单元测试平台提供专业化解决方案
c++·测试工具·单元测试