gpt4 book ai didi

java - Maven + Spring Boot : Found multiple occurrences of org. json.JSONObject 在类路径上:

转载 作者:IT老高 更新时间:2023-10-28 13:54:31 30 4
gpt4 key购买 nike

当我运行 mvn test 时,我收到此警告。我该如何解决?

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

jar:file:/C:/Users/Chloe/.m2/repository/org/json/json/20140107/json-20140107.jar!/org/json/JSONObject.class
jar:file:/C:/Users/Chloe/.m2/repository/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

这是我的pom.xml .对 JSON 的唯一引用是

    <!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>

Apache Maven 3.5.3

最佳答案

添加下

 <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>

以下排除:

 <scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>

同样,对于 Gradle 项目:

testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude group: "com.vaadin.external.google", module:"android-json"
}

关于java - Maven + Spring Boot : Found multiple occurrences of org. json.JSONObject 在类路径上:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52980064/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com