英文:
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 disappears (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:
+--- 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
...
...
...
| +--- 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. How is that possible? I know for a fact that removing these dependencies resolves the w3c conflict, so logically it has to be in there somewhere, or am I missing something?
Does anyone have any idea how this can be and what can be done about it?
英文:
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:
+--- 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. 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?
Does anyone have any idea how this can be and what can be done about it?
答案1
得分: 0
我现在成功地弄清楚了如何修复它,尽管我并不完全理解修复措施与问题之间的关系。
底线是,xml-apis
的传递性依赖在某种程度上导致了这个问题,尽管 xml-apis
本身似乎没有任何依赖关系。所以像这样写依赖关系对我来说解决了这个问题:
compile ("org.eclipse.lyo.clients:oslc-java-client:2.4.0"){
exclude module: "xml-apis"
}
是否有更令人满意的解释?到目前为止,我所知道的是 xml-apis
(https://mvnrepository.com/artifact/xml-apis/xml-apis/1.4.01) 似乎没有任何依赖关系,然而,由于某种原因它确实使用了 W3C 许可证。
英文:
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. 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.
专注分享java语言的经验与见解,让所有开发者获益!
评论