[英]Specific question concerning "The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml"
I'm in the process of migrating my companies projects from Java 1.8 to OpenJDK 14. Like multiple other people (fe. in this , this or this thread) I've run into some troubles with Java 9 Modularity, specifically with the package org.w3c.dom
.我正在将我的公司项目从 Java 1.8 迁移到 OpenJDK 14。像其他多个人一样(在这个、 这个或这个线程中)我遇到了 Java 9 模块化的一些麻烦,特别是包
org.w3c.dom
。
I have already generated the module-info.java
and currently both the JRE System Library (OpenJDK 14) and all external JARs are on the Modulepath in the Java Build Path.我已经生成了
module-info.java
,目前 JRE 系统库 (OpenJDK 14) 和所有外部 JAR 都在 Java 构建路径的 Modulepath 上。 So I no longer have the error module: <unnamed>
.所以我不再有错误
module: <unnamed>
。 The actual compile error I get right now is:我现在得到的实际编译错误是:
The package org.w3c.dom is accessible from more than one module: batik.all, java.xml, xml.apis.ext
BTW I can't just simply delete the JARs batik.all
and xml.apis.ext
, since other packages of those are used in the project which are not in the JavaSE.顺便说一句,我不能简单地删除 JAR
batik.all
和xml.apis.ext
,因为项目中使用的其他包不在 JavaSE 中。
I've also been told by my supervisors to not convert any non-maven projects to maven projects, which I mention since all other references I find to this problem seem to discuss the solution of utilising Maven Dependencies and Excludes.我的主管还告诉我不要将任何非 maven 项目转换为 maven 项目,我提到了这一点,因为我发现的所有其他参考资料似乎都在讨论利用 Maven 依赖项和排除项的解决方案。
Now after some analysis I've come to the conclusion that the most effective way for me to get rid of these errors would be to unpack the two JAR files, decompile the packages, delete the duplicate org.w3c.dom
from those external JARs and finally recompile the whole thing and pass that custom JAR to the build path.现在经过一些分析,我得出的结论是,我摆脱这些错误的最有效方法是解压两个 JAR 文件,反编译这些包,从这些外部 JAR 中删除重复的
org.w3c.dom
并最后重新编译整个内容并将该自定义 JAR 传递到构建路径。
module-info.java
, so perhaps there's a way simpler way of excluding those packages in that file?module-info.java
,所以也许有一种更简单的方法来排除该文件中的那些包? I'm open for alternative solutions!您不需要反编译/重新编译任何东西,您只需删除该包对应的 JAR 文件中的目录即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.