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'

}
目录
相关文章
|
资源调度 JavaScript Windows
yarn install命令报错解决办法-warning package-lock.json found.
yarn install命令报错解决办法-warning package-lock.json found.
786 0
|
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
1033 0
|
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
512 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错误
1097 0
|
JSON NoSQL 数据库
bad JSON array format - found no opening bracket
  我真的不想吐槽mongodb,也可能是刚接触mongodb不久,mongodb数据库真的不是像传说中说的那么好上手。今天有个需求,需要从远程库导出json格式的数据文件,然后导入到另一个远程库。
2986 0
|
JSON 数据格式
IE8 MIME type application/json not found
如果: public ContentResult GetPaper(string testId) {     return ControllProctector.Do1(() =>         {             var result = new UserPaperBll().
849 0
|
4月前
|
JSON API 数据格式
淘宝拍立淘按图搜索API系列,json数据返回
淘宝拍立淘按图搜索API系列通过图像识别技术实现商品搜索功能,调用后返回的JSON数据包含商品标题、图片链接、价格、销量、相似度评分等核心字段,支持分页和详细商品信息展示。以下是该API接口返回的JSON数据示例及详细解析:
|
4月前
|
JSON 算法 API
Python采集淘宝商品评论API接口及JSON数据返回全程指南
Python采集淘宝商品评论API接口及JSON数据返回全程指南