问题
JAXB (Java Architecture for XML Binding) has been publised as Maven artifacts although it was bundled with JREs until Java 8 (and Java 9/10 with an option).
My question here is: Which JAXB version on Maven Central corresponds to Java 8's bundled version? (And, also for Java 9/10's under a feature option?)
I'm seeing in https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api :
- 2.2.* (~ 2.2.12)
- 2.3.0
- 2.3.1
- 2.4.0-* (under development)
- (3.0.0 to be
jakarta.xml.*
)
回答1:
As far as Java 8:
$ $(/usr/libexec/java_home -v 1.8)/bin/xjc -version
xjc 2.2.8-b130911.1802
which is documented here specifying the Maven coordinates:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-bom</artifactId>
<version>2.2.8</version>
<type>pom</type>
</dependency>
although
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.8</version>
<scope>provided</scope>
</dependency>
is accurate for Java 8. For Java 9+, the latest available (as you observed) is:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
来源:https://stackoverflow.com/questions/63608553/which-jaxb-version-was-used-in-java-8