[英]The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml ~ Find and exclude dependency
I know there's already some topics on issues like these, but the case I've come across is somehow different.我知道已经有一些关于此类问题的主题,但我遇到的情况有些不同。
It starts with this error message:它以以下错误消息开头:
import org.w3c.dom.Element;
The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml
I know that the following dependency "causes" this, because if I remove it, this error disapperas (and many others pop up):我知道以下依赖项“导致”了这种情况,因为如果我删除它,这个错误就会消失(并且会弹出许多其他错误):
compile "org.eclipse.lyo.clients:oslc-java-client:2.4.0"
I have already tried this:我已经尝试过这个:
compile ("org.eclipse.lyo.clients:oslc-java-client:2.4.0") {
exclude group: "org.w3c.dom", module: "org.w3c.dom"
}
However, that did not change anything about the issue.但是,这并没有改变这个问题的任何内容。
I have tried listing the transitive dependencies using gradle dependencies
, which returned me this dependency tree for the OSLC Java Client:我尝试使用
gradle dependencies
列出传递依赖项,它为我返回了 OSLC Java 客户端的依赖关系树:
+--- org.eclipse.lyo.clients:oslc-java-client:2.4.0
| +--- org.slf4j:slf4j-api:1.7.25
| +--- org.apache.jena:apache-jena-libs:3.6.0
| | +--- org.apache.jena:jena-tdb:3.6.0
| | | +--- org.apache.jena:jena-arq:3.6.0
| | | | +--- org.apache.jena:jena-core:3.6.0
| | | | | +--- org.slf4j:slf4j-api:1.7.25
| | | | | +--- org.apache.jena:jena-iri:3.6.0
| | | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | | +--- xerces:xercesImpl:2.11.0
| | | | | | \--- xml-apis:xml-apis:1.4.01
| | | | | +--- commons-cli:commons-cli:1.4
| | | | | \--- org.apache.jena:jena-base:3.6.0
| | | | | +--- org.apache.jena:jena-shaded-guava:3.6.0
| | | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | | +--- org.apache.commons:commons-csv:1.5
| | | | | +--- commons-io:commons-io:2.6
| | | | | +--- org.apache.commons:commons-lang3:3.4
| | | | | +--- com.github.andrewoma.dexx:collection:0.7
| | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | +--- org.apache.jena:jena-shaded-guava:3.6.0 (*)
| | | | +--- org.apache.httpcomponents:httpclient:4.5.3
| | | | | +--- org.apache.httpcomponents:httpcore:4.4.6
| | | | | +--- commons-logging:commons-logging:1.2
| | | | | \--- commons-codec:commons-codec:1.9
| | | | +--- com.github.jsonld-java:jsonld-java:0.11.1
| | | | | +--- com.fasterxml.jackson.core:jackson-core:2.9.0
| | | | | +--- com.fasterxml.jackson.core:jackson-databind:2.9.0
| | | | | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0
| | | | | | \--- com.fasterxml.jackson.core:jackson-core:2.9.0
| | | | | +--- org.slf4j:jcl-over-slf4j:1.7.25
| | | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | | \--- commons-io:commons-io:2.5 -> 2.6
| | | | +--- org.apache.httpcomponents:httpclient-cache:4.5.3
| | | | | \--- org.apache.httpcomponents:httpclient:4.5.3 (*)
| | | | +--- org.apache.thrift:libthrift:0.10.0
| | | | | +--- org.slf4j:slf4j-api:1.7.12 -> 1.7.25
| | | | | \--- org.apache.httpcomponents:httpclient:4.4.1 -> 4.5.3 (*)
| | | | +--- org.slf4j:jcl-over-slf4j:1.7.25 (*)
| | | | +--- org.apache.commons:commons-lang3:3.4
| | | | \--- org.slf4j:slf4j-api:1.7.25
| | | \--- org.slf4j:slf4j-api:1.7.25
| | +--- org.apache.jena:jena-tdb2:3.6.0
| | | +--- org.apache.jena:jena-dboe-trans-data:3.6.0
| | | | +--- org.apache.jena:jena-dboe-transaction:3.6.0
| | | | | +--- org.apache.jena:jena-dboe-base:3.6.0
| | | | | | +--- org.apache.jena:jena-arq:3.6.0 (*)
| | | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | +--- org.apache.jena:jena-dboe-index:3.6.0
| | | | | +--- org.apache.jena:jena-dboe-base:3.6.0 (*)
| | | | | \--- org.slf4j:slf4j-api:1.7.25
| | | | \--- org.slf4j:slf4j-api:1.7.25
| | | \--- org.slf4j:slf4j-api:1.7.25
| | +--- org.apache.jena:jena-rdfconnection:3.6.0
| | | +--- org.apache.jena:jena-arq:3.6.0 (*)
| | | \--- org.slf4j:slf4j-api:1.7.25
| | \--- org.slf4j:slf4j-api:1.7.25
| +--- net.oauth.core:oauth:20100527
| +--- net.oauth.core:oauth-consumer:20100527
| | \--- net.oauth.core:oauth:20100527
| +--- net.oauth.core:oauth-httpclient4:20090913
| | +--- net.oauth.core:oauth-consumer:20090617 -> 20100527 (*)
| | \--- org.apache.httpcomponents:httpclient:4.0 -> 4.5.3 (*)
| +--- org.apache.wink:wink-client:1.4 (*)
| +--- org.apache.wink:wink-client-apache-httpclient:1.4
| | +--- org.apache.wink:wink-client:1.4 (*)
| | \--- org.apache.httpcomponents:httpclient:4.1.3 -> 4.5.3 (*)
| +--- org.eclipse.lyo.oslc4j.core:oslc4j-core:2.4.0
| | +--- javax.ws.rs:jsr311-api:1.1.1
| | +--- org.apache.jena:apache-jena-libs:3.6.0 (*)
| | +--- org.slf4j:slf4j-api:1.7.25
| | \--- org.assertj:assertj-core:3.8.0
| +--- org.eclipse.lyo.oslc4j.core:oslc4j-jena-provider:2.4.0
| | +--- org.eclipse.lyo.oslc4j.core:oslc4j-core:2.4.0 (*)
| | +--- xml-apis:xml-apis:1.3.04 -> 1.4.01
| | +--- xerces:xercesImpl:2.8.0 -> 2.11.0 (*)
| | +--- org.slf4j:slf4j-api:1.7.25
| | \--- org.apache.jena:apache-jena-libs:3.6.0 (*)
| +--- org.eclipse.lyo.oslc4j.core:oslc4j-json4j-provider:2.4.0
| | +--- org.eclipse.lyo.oslc4j.core:oslc4j-core:2.4.0 (*)
| | \--- org.apache.wink:wink-json4j:1.2.1-incubating
| +--- org.apache.httpcomponents:httpcore:4.4.5 -> 4.4.6
| +--- org.apache.httpcomponents:httpclient:4.5.2 -> 4.5.3 (*)
| +--- xerces:xercesImpl:2.8.0 -> 2.11.0 (*)
| +--- xml-apis:xml-apis:1.3.04 -> 1.4.01
| +--- javax.servlet:javax.servlet-api:3.1.0
| \--- javax.ws.rs:jsr311-api:1.1.1
Now, what baffles me is that w3c
does not seem to exist anywhere in that tree.现在,让我感到困惑的是,
w3c
似乎在那棵树的任何地方都不存在。 How is that possible?这怎么可能? I know for a fact that removing this dependencies resolves the w3c conflict, so logically it has to be in there somewhere, or am I missing something?
我知道删除此依赖项解决了 w3c 冲突这一事实,所以从逻辑上讲它必须在某个地方,或者我错过了什么?
Does anyone have any idea how this can be and what can be done about it?有谁知道这是怎么回事以及可以做些什么?
I now managed to figure out how to fix it, even though I don't have a perfect understanding how the fix relates to the problem.我现在设法弄清楚如何修复它,即使我不完全了解修复与问题的关系。
The bottom line is that the transitive dependency on xml-apis
somehow caused this, even though xml-apis
does not seem to have any dependencies on its own.底线是对
xml-apis
的传递依赖以某种方式导致了这种情况,即使xml-apis
本身似乎没有任何依赖关系。 So writing the dependency like this fixed the issue for me:因此,像这样编写依赖项为我解决了这个问题:
compile ("org.eclipse.lyo.clients:oslc-java-client:2.4.0"){
exclude module: "xml-apis"
}
Does anyone have a more satisfying explanation for this?有人对此有更令人满意的解释吗? Thus far, all I know is that
xml-apis
( https://mvnrepository.com/artifact/xml-apis/xml-apis/1.4.01 ) does not seem to have any dependencies, however , it does for some reason use the W3C License.到目前为止,我所知道的是
xml-apis
( https://mvnrepository.com/artifact/xml-apis/xml-apis/1.4.01 ) 似乎没有任何依赖关系,但是,它出于某种原因使用W3C 许可证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.