简体   繁体   English

关于“可以从多个模块访问包 org.w3c.dom 的具体问题:<unnamed> ,java.xml&quot;

[英]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.allxml.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 传递到构建路径。

  1. Does that idea make sense?这个想法有意义吗? Would you do it this way if you couldn't use Maven dependencies?如果您不能使用 Maven 依赖项,您会这样做吗?
  2. Since we're migrating from 1.8, I've never actually used module-info.java , so perhaps there's a way simpler way of excluding those packages in that file?由于我们从 1.8 迁移,我从未真正使用过module-info.java ,所以也许有一种更简单的方法来排除该文件中的那些包? I'm open for alternative solutions!我对替代解决方案持开放态度!
  3. Last but not least, if my described solution is the way to go, what would be the best way to unpack and repack those JAR files?最后但并非最不重要的一点是,如果我所描述的解决方案是可行的,那么解压和重新打包这些 JAR 文件的最佳方法是什么?

您不需要反编译/重新编译任何东西,您只需删除该包对应的 JAR 文件中的目录即可。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 package org.w3c.dom 可以从多个模块访问:<unnamed> , java.xml</unnamed> - The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml package org.w3c.dom 可以从多个模块访问:<unnamed> , java.xml ~ 查找和排除依赖</unnamed> - The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml ~ Find and exclude dependency 排除依赖无助于修复“package org.w3c.dom 可以从多个模块访问:<unnamed> , java.xml”</unnamed> - Excluding dependency does not help to fix “The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml” 包 javax.xml.stream 可以从多个模块访问:<unnamed> , java.xml - The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml package javax.xml.namespace 可以从多个模块访问:<unnamed> , eclipse 网络服务中的 java.xml</unnamed> - The package javax.xml.namespace is accessible from more than one module: <unnamed>, java.xml in eclipse webservice gwt-user.jar 和 Java 11 - package javax.xml.parsers 可以从多个模块访问:<unnamed> , java.xml</unnamed> - gwt-user.jar with Java 11 - The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml 可从多个模块访问的包:<unnamed> - Package accessible from more than one module: <unnamed> 春季启动2。Java10。JUnit。 可以从多个模块中访问org.slf4j软件包: <unnamed> ,slf4j.api - Spring boot 2. Java 10. JUnit. The package org.slf4j is accessible from more than one module: <unnamed>, slf4j.api 在XML org.w3c.dom中阅读特殊字符 - Reading special Charanters in XML org.w3c.dom 为什么org.w3c.dom解析我的xml错误? - Why is org.w3c.dom parsing my xml wrong?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM