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"
}
Gradleプロジェクトに次の行を追加します。
testCompile('org.springframework.boot:spring-boot-starter-test'){
exclude group: "com.vaadin.external.google", module:"Android-json"
}
これは私のために働いた:
configurations {
testImplementation.exclude group: 'com.vaadin.external.google', module: 'Android-json'
}