更新时间:2023-09-30 13:18:04
与Oracle澄清后,应使用以下工件:
After clarification with Oracle, the following artifacts should be used:
如果要将 XML 解组为 Java 对象或将 Java 对象编组为 XML:
If you want to unmarshal XML to Java objects or marshal Java objects as XML:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>...</version>
</dependency>
如果您有一个 XML Schema 并想从中生成 Java 代码:
If you have an XML Schema and want to generate the Java code out of it:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>...</version>
</dependency>
schemagen
)如果您有带有 JAXB 注释的 Java 类并希望基于它们生成 XML Schema:
schemagen
)If you have Java classes with JAXB annotations and want to generate a XML Schema based on them:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-jxc</artifactId>
<version>...</version>
</dependency>
后两个工件(org.glassfish.jaxb:jaxb-xjc
和 org.glassfish.jaxb:jaxb-jxc
)由 Maven 插件包装,因此您通常在运行时不需要它们.
The two latter artifacts (org.glassfish.jaxb:jaxb-xjc
and org.glassfish.jaxb:jaxb-jxc
) are wrapped by Maven plugins so you normally would not need them in the runtime.
如果您的 Maven 项目无法获得完整的类路径,请打开调试输出并检查 Maven 控制台.您可能会在此处看到以下错误消息:
If your Maven projects somehow don't get the full classpath, turn on debug output and check the Maven console. You might be seeing the following error message there:
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar 必须指定绝对路径,但为 ${tools.jar} @
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @
这是由于以下问题:
@rustyx 的 解决方案 是将 -vm
选项添加到 eclipse.ini
:
The solution by @rustyx is to add -vm
option to the eclipse.ini
:
-vm
<PATH_TO_JDK>jreinjavaw.exe