Found multiple occurrences of org.json.JSONObject on the class path:

简介: Found multiple occurrences of org.json.JSONObject on the class path:

gradle

测试项目中警告

Found multiple occurrences of org.json.JSONObject on the class path:

  jar:file:/D:/apache-maven-3.6/testsoft/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
jar:file:/D:/apache-maven-3.6/testsoft/org/json/json/20170516/json-20170516.jar!/org/json/JSONObject.class

原因是在spring-boot-starter-test拉入“ android-json”(com.vaadin.external.google)

解决方法是:

在 配置 文件中 把对应的jar包依赖忽略掉即可

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'


    developmentOnly 'org.springframework.boot:spring-boot-devtools'
//    implementation 'org.springframework.boot:spring-boot-starter-log4j2'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'

    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
        exclude group: 'com.vaadin.external.google', module: 'android-json'
    }

    implementation 'org.jsoup:jsoup:1.10.3'
    implementation 'org.json:json:20190722'

}
目录
相关文章
|
8月前
|
资源调度 JavaScript Windows
yarn install命令报错解决办法-warning package-lock.json found.
yarn install命令报错解决办法-warning package-lock.json found.
146 0
|
8月前
|
JSON 监控 数据格式
Grafana导入 json 文件的 dashboard 错误 Templating Failed to upgrade legacy queries Datasource xxx not found
Grafana导入 json 文件的 dashboard 错误 Templating Failed to upgrade legacy queries Datasource xxx not found
235 0
|
2月前
|
JavaScript
【Vue Error】Virtual script not found, may missing <script lang=“ts“> “allowJs“: true / jsconfig.json
【Vue Error】Virtual script not found, may missing <script lang=“ts“> “allowJs“: true / jsconfig.json
|
JSON 前端开发 Java
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo
294 0
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo
|
JSON 数据格式
解决:Could not write JSON: No serializer found for class *** and no properties错误
解决:Could not write JSON: No serializer found for class *** and no properties错误
582 0
|
JSON NoSQL 数据库
bad JSON array format - found no opening bracket
  我真的不想吐槽mongodb,也可能是刚接触mongodb不久,mongodb数据库真的不是像传说中说的那么好上手。今天有个需求,需要从远程库导出json格式的数据文件,然后导入到另一个远程库。
2819 0
|
JSON 数据格式
IE8 MIME type application/json not found
如果: public ContentResult GetPaper(string testId) {     return ControllProctector.Do1(() =>         {             var result = new UserPaperBll().
771 0
|
16天前
|
存储 JSON JavaScript
【chat-gpt问答记录】python将数据存为json格式和yaml格式
【chat-gpt问答记录】python将数据存为json格式和yaml格式
28 1
|
3天前
|
存储 JSON JavaScript
使用JSONObject解析与生成JSON数据
使用JSONObject解析与生成JSON数据