且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java 11:在模块路径或类路径上找不到JAXB-API的实现

更新时间:2021-07-15 01:27:38

该解决方案非常简单.首先,使用jaxb 2.3.1. Beta材料仅用于测试. 真正的问题是module-info.java. jaxb必须具有2个条目:

The solution is very easy. First, use jaxb 2.3.1. The beta-stuff is for testing only. The real problem was the module-info.java. It is required to have 2 entries for jaxb:

requires java.xml.bind;
requires com.sun.xml.bind;

第一个要求定义实现,第二个要求定义API.

The first requires defines the implementation, the second the API.

仅需两个依赖项:

compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
compile group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.1'