XJC 的最新官方版本是什么,我在哪里可以得到它?
What is the latest official version of XJC and where can I get it?
XJC(XML Java 编译器)是 JAXB(Java XML绑定)。
如果我查看 official website,JAXB 的最新版本似乎是 2.2.11。这是你刚安装最新的 JDK 版本 8u40.
时得到的那个
以下输出显示 XJC 与 JDK 8u40 相关的版本:
../JDK8u40/bin$ ./javac -version
javac 1.8.0_40
../JDK8u40/bin$ ./xjc -version
xjc 2.2.8-b130911.1802
(原来的JDK路径不同于OS到OS,所以这只是一个示例性的表示。)
似乎 XJC 的版本与 "latest" JAXB 版本或最新的 JDK 版本不同不包含最新的 JAXB 版本。
我的解决方法是从 Maven repository. Sounds easy, but why the latest version of JAXB is 2.2.12 now? Forgot to put the documentation on the offical website? Okay, I just try to don't care... After the successful installation process I noticed there is no XJC inside this package. So go on searching... I found another Maven repository with the name "JAXB-XJC”安装最新的 JAXB 版本。但这只是源代码。我只想安装 XJC[=58 的最新二进制文件=]。我看了一下版本号,是2.2.11。看起来至少比2.2.8好。
但是我在哪里可以获得 XJC 的最新二进制文件?
为什么我要安装XJC的最新二进制文件?因为我想知道它是否支持 Java 8 and/or 的 Optionals 是否支持 XSD 模式版本 1.1。在 Internet 的某个地方,我阅读了最新的 XJC 至少支持 XSD 模式版本 1.1。现在就足够了。但是要解决这个问题,Oracle 似乎必须解决他们可怕的版本混乱问题。
更新
我尝试通过克隆官方 Git repository 并执行 mvn clean install
.
来构建 JAXB
结果:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JAXB BOM ........................................... SUCCESS [ 0.140 s]
[INFO] JAXB BOM with ALL dependencies ..................... SUCCESS [ 0.005 s]
[INFO] JAXB Reference Implementation ...................... SUCCESS [ 0.515 s]
[INFO] JAXB External parent ............................... SUCCESS [ 0.009 s]
[INFO] RNGOM .............................................. SUCCESS [ 3.723 s]
[INFO] Codemodel .......................................... SUCCESS [ 0.008 s]
[INFO] Codemodel Core ..................................... SUCCESS [ 2.622 s]
[INFO] Codemodel Annotation Compiler ...................... SUCCESS [ 0.848 s]
[INFO] JAXB TXW parent .................................... SUCCESS [ 0.006 s]
[INFO] TXW2 Runtime ....................................... SUCCESS [ 1.920 s]
[INFO] TXW2 Compiler ...................................... SUCCESS [ 1.507 s]
[INFO] JAXB Core .......................................... SUCCESS [ 1.745 s]
[INFO] JAXB Runtime parent ................................ SUCCESS [ 0.008 s]
[INFO] JAXB Runtime ....................................... SUCCESS [ 5.932 s]
[INFO] JAXB1 Runtime ...................................... SUCCESS [ 1.520 s]
[INFO] JAXB XJC ........................................... SUCCESS [ 5.555 s]
[INFO] JAXB JXC ........................................... SUCCESS [ 2.928 s]
[INFO] Parent for osgi testing modules. ................... SUCCESS [ 0.009 s]
[INFO] osgi-test-parent ................................... SUCCESS [ 1.315 s]
[INFO] osgi-test-core ..................................... SUCCESS [ 0.676 s]
[INFO] JAXB bundles ....................................... SUCCESS [ 0.007 s]
[INFO] Old JAXB Core ...................................... SUCCESS [ 4.669 s]
[INFO] osgi-test-runtime .................................. SUCCESS [ 0.677 s]
[INFO] Old JAXB Runtime ................................... SUCCESS [ 3.251 s]
[INFO] osgi-test-xjc ...................................... SUCCESS [ 0.637 s]
[INFO] Old JAXB XJC ....................................... SUCCESS [ 4.385 s]
[INFO] osgi-test-jxc ...................................... SUCCESS [ 0.607 s]
[INFO] Old JAXB JXC ....................................... SUCCESS [ 2.169 s]
[INFO] JAXB Documentation parent .......................... SUCCESS [ 0.005 s]
[INFO] JAXB Release Documentation ......................... SUCCESS [ 12.401 s]
[INFO] JAXB samples ....................................... SUCCESS [ 0.375 s]
[INFO] JAXB RI ............................................ SUCCESS [ 1.079 s]
[INFO] JAXB OSGI parent ................................... SUCCESS [ 0.005 s]
[INFO] JAXB extra OSGI .................................... FAILURE [ 6.668 s]
[INFO] JAXB OSGI .......................................... SKIPPED
[INFO] osgi-test-osgi ..................................... SKIPPED
[INFO] osgi-test-extra_osgi ............................... SKIPPED
[INFO] JAXB OSGi Tests .................................... SKIPPED
[INFO] JAXB WWW Help files ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2015-03-11T15:40:59+01:00
[INFO] Final Memory: 83M/1546M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.0:shade (default) on project jaxb-extra-osgi: Error creating shaded jar: java.util.jar.Attributes cannot be cast to java.lang.String -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jaxb-extra-osgi
构建过程总是在 JAXB extra OSGI 目标处失败。 JAXB XJC 目标构建成功,但只包含一个抛出异常的 jar 文件,但没有名为 xjc 的二进制文件。那么它在哪里呢?
我已经修复了 JAXB maven 构建中的 OSGi 故障。所以现在应该可以了。
此外,为了快速构建,您可以尝试使用:
$ mvn clean install -Ddev
这将 运行 快速构建而不创建 docs/osgi-tests。
您还可以在 $JAXB_HOME/bundles/ri/target/
中找到旧版 jaxb-ri.zip
(带有 bin/libs/examples/)。或者,如果您不想每次都在构建后解压缩它,请直接转到:$JAXB_HOME/bundles/ri/target/stage/jaxb-ri/
。
PS:如果您使用独立的 JAXB,请不要忘记对 jaxb-api.jar 使用 JAVA endorsed mechanism。
XJC(XML Java 编译器)是 JAXB(Java XML绑定)。
如果我查看 official website,JAXB 的最新版本似乎是 2.2.11。这是你刚安装最新的 JDK 版本 8u40.
时得到的那个以下输出显示 XJC 与 JDK 8u40 相关的版本:
../JDK8u40/bin$ ./javac -version
javac 1.8.0_40
../JDK8u40/bin$ ./xjc -version
xjc 2.2.8-b130911.1802
(原来的JDK路径不同于OS到OS,所以这只是一个示例性的表示。)
似乎 XJC 的版本与 "latest" JAXB 版本或最新的 JDK 版本不同不包含最新的 JAXB 版本。
我的解决方法是从 Maven repository. Sounds easy, but why the latest version of JAXB is 2.2.12 now? Forgot to put the documentation on the offical website? Okay, I just try to don't care... After the successful installation process I noticed there is no XJC inside this package. So go on searching... I found another Maven repository with the name "JAXB-XJC”安装最新的 JAXB 版本。但这只是源代码。我只想安装 XJC[=58 的最新二进制文件=]。我看了一下版本号,是2.2.11。看起来至少比2.2.8好。
但是我在哪里可以获得 XJC 的最新二进制文件?
为什么我要安装XJC的最新二进制文件?因为我想知道它是否支持 Java 8 and/or 的 Optionals 是否支持 XSD 模式版本 1.1。在 Internet 的某个地方,我阅读了最新的 XJC 至少支持 XSD 模式版本 1.1。现在就足够了。但是要解决这个问题,Oracle 似乎必须解决他们可怕的版本混乱问题。
更新
我尝试通过克隆官方 Git repository 并执行 mvn clean install
.
结果:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JAXB BOM ........................................... SUCCESS [ 0.140 s]
[INFO] JAXB BOM with ALL dependencies ..................... SUCCESS [ 0.005 s]
[INFO] JAXB Reference Implementation ...................... SUCCESS [ 0.515 s]
[INFO] JAXB External parent ............................... SUCCESS [ 0.009 s]
[INFO] RNGOM .............................................. SUCCESS [ 3.723 s]
[INFO] Codemodel .......................................... SUCCESS [ 0.008 s]
[INFO] Codemodel Core ..................................... SUCCESS [ 2.622 s]
[INFO] Codemodel Annotation Compiler ...................... SUCCESS [ 0.848 s]
[INFO] JAXB TXW parent .................................... SUCCESS [ 0.006 s]
[INFO] TXW2 Runtime ....................................... SUCCESS [ 1.920 s]
[INFO] TXW2 Compiler ...................................... SUCCESS [ 1.507 s]
[INFO] JAXB Core .......................................... SUCCESS [ 1.745 s]
[INFO] JAXB Runtime parent ................................ SUCCESS [ 0.008 s]
[INFO] JAXB Runtime ....................................... SUCCESS [ 5.932 s]
[INFO] JAXB1 Runtime ...................................... SUCCESS [ 1.520 s]
[INFO] JAXB XJC ........................................... SUCCESS [ 5.555 s]
[INFO] JAXB JXC ........................................... SUCCESS [ 2.928 s]
[INFO] Parent for osgi testing modules. ................... SUCCESS [ 0.009 s]
[INFO] osgi-test-parent ................................... SUCCESS [ 1.315 s]
[INFO] osgi-test-core ..................................... SUCCESS [ 0.676 s]
[INFO] JAXB bundles ....................................... SUCCESS [ 0.007 s]
[INFO] Old JAXB Core ...................................... SUCCESS [ 4.669 s]
[INFO] osgi-test-runtime .................................. SUCCESS [ 0.677 s]
[INFO] Old JAXB Runtime ................................... SUCCESS [ 3.251 s]
[INFO] osgi-test-xjc ...................................... SUCCESS [ 0.637 s]
[INFO] Old JAXB XJC ....................................... SUCCESS [ 4.385 s]
[INFO] osgi-test-jxc ...................................... SUCCESS [ 0.607 s]
[INFO] Old JAXB JXC ....................................... SUCCESS [ 2.169 s]
[INFO] JAXB Documentation parent .......................... SUCCESS [ 0.005 s]
[INFO] JAXB Release Documentation ......................... SUCCESS [ 12.401 s]
[INFO] JAXB samples ....................................... SUCCESS [ 0.375 s]
[INFO] JAXB RI ............................................ SUCCESS [ 1.079 s]
[INFO] JAXB OSGI parent ................................... SUCCESS [ 0.005 s]
[INFO] JAXB extra OSGI .................................... FAILURE [ 6.668 s]
[INFO] JAXB OSGI .......................................... SKIPPED
[INFO] osgi-test-osgi ..................................... SKIPPED
[INFO] osgi-test-extra_osgi ............................... SKIPPED
[INFO] JAXB OSGi Tests .................................... SKIPPED
[INFO] JAXB WWW Help files ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2015-03-11T15:40:59+01:00
[INFO] Final Memory: 83M/1546M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.0:shade (default) on project jaxb-extra-osgi: Error creating shaded jar: java.util.jar.Attributes cannot be cast to java.lang.String -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jaxb-extra-osgi
构建过程总是在 JAXB extra OSGI 目标处失败。 JAXB XJC 目标构建成功,但只包含一个抛出异常的 jar 文件,但没有名为 xjc 的二进制文件。那么它在哪里呢?
我已经修复了 JAXB maven 构建中的 OSGi 故障。所以现在应该可以了。
此外,为了快速构建,您可以尝试使用:
$ mvn clean install -Ddev
这将 运行 快速构建而不创建 docs/osgi-tests。
您还可以在 $JAXB_HOME/bundles/ri/target/
中找到旧版 jaxb-ri.zip
(带有 bin/libs/examples/)。或者,如果您不想每次都在构建后解压缩它,请直接转到:$JAXB_HOME/bundles/ri/target/stage/jaxb-ri/
。
PS:如果您使用独立的 JAXB,请不要忘记对 jaxb-api.jar 使用 JAVA endorsed mechanism。