今天在测试代码的时候报了以下错误,特此记录:
Found multiple occurrences of org.json.JSONObject on the class path:
jar:file:/D:/OpenSources/MyRepository/org/json/json/20170516/json-20170516.jar!/org/json/JSONObject.class
jar:file:/D:/OpenSources/MyRepository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
You may wish to exclude one of them to ensure predictable runtime behavior
解决方案:
<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>
原文链接:https://blog.csdn.net/Mr_Mocha/article/details/88917898