更新现有的Spring Boot项目,从Java 1.8升级到Java 11。

huangapple go评论79阅读模式
英文:

Update existing Spring Boot project from java 1.8 to java 11

问题

从存储库中提取了一个完全功能的Spring Boot应用程序代码,与Java 1.8一起运行良好。升级到Java 11后出现了错误,例如某些包可从多个模块访问:

  1. The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml
  2. The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml

尝试通过以下链接提供的方法来解决此问题,但未能解决:

  1. https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670
  2. https://www.eclipse.org/eclipse/news/4.8/jdt.php#Java9
英文:

Materialised fully functional Spring Boot application code from repository and working fine with java 1.8. While upgrading to Java 11 got errors like some packages is accessible from more than one module

1.The package javax.xml.parsers is accessible from more than one module: <unnamed>, java.xml

2.The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml

Tried to resolve the issue by restrict dependency using methods provided in the below links but not helped.

  1. https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670

  2. https://www.eclipse.org/eclipse/news/4.8/jdt.php#Java9

Setting Eclipse JRE

Setting Java Version in POM

Setting Sping Version

Archiva dependency integrated to Spring Boot as rootParent

Error While upgrading to java 11

Build path of migrated project

答案1

得分: 0

原因:xml.apisjava.xml 之间存在冲突,这是由于Java中的模块化概念引起的。

解决方案:在Maven的pom文件中排除xml.apis依赖项。

英文:

Reason : Conflict between xml.apis and java.xml.due to the modularity concept in java

Solution : Excluded xml.apis dependency in maven pom file.

huangapple
  • 本文由 发表于 2020年7月22日 00:17:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/63018710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定