Advertisement

单元测试错误Found multiple occurrences of org.json.JSONObject on the class path

阅读量:

编译错误

单元测试启动错误

复制代码
    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
    
    
    bash

分析:依赖冲突

解决办法:排除依赖

复制代码
     <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>
    
    
    xml
![](https://ad.itadn.com/c/weblog/blog-img/images/2025-07-13/FShHziYvK0PsfLDgjU5Euaen4qCA.png)

全部评论 (0)

还没有任何评论哟~