Java 8中使用的JAXB版本是哪个?

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

Which JAXB version was used in Java 8?

问题

JAXB(Java Architecture for XML Binding)已经作为Maven构件发布,尽管在Java 8之前(以及Java 9/10选择性地)它是与JRE捆绑在一起的。

我在这里的问题是:Maven中央仓库中哪个JAXB版本对应于Java 8捆绑版本?(还有,对于Java 9/10,在一个功能选项下是什么版本?)

我在https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api 上看到:

  • 2.2.*(~ 2.2.12)
  • 2.3.0
  • 2.3.1
  • 2.4.0-*(正在开发中)
  • (3.0.0将成为jakarta.xml.*
英文:

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

得分: 11

截止到Java 8版本:

$ $(/usr/libexec/java_home -v 1.8)/bin/xjc -version
xjc 2.2.8-b130911.1802

相关文档可在此处找到,其中指定了Maven坐标:

<dependency>
  <groupId>org.glassfish.jaxb</groupId>
  <artifactId>jaxb-bom</artifactId>
  <version>2.2.8</version>
  <type>pom</type>
</dependency>

不过对于Java 8,准确的依赖如下:

<dependency>                                                          
  <groupId>javax.xml.bind</groupId>                                   
  <artifactId>jaxb-api</artifactId>                                   
  <version>2.2.8</version>                                            
  <scope>provided</scope>                                             
</dependency>

至于Java 9+,最新可用的依赖(正如您所观察到的)是:

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.4.0-b180830.0359</version>
</dependency>
英文:

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:

&lt;dependency&gt;
  &lt;groupId&gt;org.glassfish.jaxb&lt;/groupId&gt;
  &lt;artifactId&gt;jaxb-bom&lt;/artifactId&gt;
  &lt;version&gt;2.2.8&lt;/version&gt;
  &lt;type&gt;pom&lt;/type&gt;
&lt;/dependency&gt;

although

          &lt;dependency&gt;                                                          
            &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;                                   
            &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;                                   
            &lt;version&gt;2.2.8&lt;/version&gt;                                            
            &lt;scope&gt;provided&lt;/scope&gt;                                             
          &lt;/dependency&gt;

is accurate for Java 8. For Java 9+, the latest available (as you observed) is:

&lt;dependency&gt;
    &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
    &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
    &lt;version&gt;2.4.0-b180830.0359&lt;/version&gt;
&lt;/dependency&gt;

huangapple
  • 本文由 发表于 2020年8月27日 11:06:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/63608553.html
匿名

发表评论

匿名网友

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

确定