Dai*_*UBE 4 java jaxb maven java-8
JAXB(Java Architecture for XML Binding)已作为 Maven 工件发布,尽管它在 Java 8(以及具有选项的 Java 9/10)之前与 JRE 捆绑在一起。
我的问题是:Maven Central 上的哪个 JAXB 版本对应于 Java 8 的捆绑版本?(并且,也适用于 Java 9/10 的功能选项吗?)
我在https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api中看到:
jakarta.xml.*)All*_*all 11
就 Java 8 而言:
$ $(/usr/libexec/java_home -v 1.8)/bin/xjc -version
xjc 2.2.8-b130911.1802
Run Code Online (Sandbox Code Playgroud)
此处记录了指定 Maven 坐标的信息:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-bom</artifactId>
<version>2.2.8</version>
<type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
虽然
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.8</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
对于 Java 8 是准确的。对于 Java 9+,最新可用的(如您所观察到的)是:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)