如何为 JAXB2 Maven 插件指定 javax.xml.accessExternalSchema [英] How to specify javax.xml.accessExternalSchema for the JAXB2 Maven plugin
问题描述
我有一个 maven 插件 (jaxb2),我需要为它提供一个 jvm arg.我不认为有一个标签可以在 pom 中为它添加 jvm args.
I have a maven plugin (jaxb2) and I need to supply a jvm arg to it. I don't think there is a tag to add jvm args in the pom for it.
我知道我可以在命令行中传入 jvm 参数,例如:mvn clean install -Djavax.xml.accessExternalSchema=all
I know I can pass in jvm args on the command line eg: mvn clean install -Djavax.xml.accessExternalSchema=all
是否可以在 pom 中设置这个 jvm arg,这样我就不必每次都在命令行中输入它?
Is it possible to set this jvm arg in the pom so that I don't have to type it into the command line every time?
(顺便说一句 - 这个 jvm arg 是必需的,以便它与 JAVA-8 一起工作.它与 JAVA-7 一起工作)
(As aside - this jvm arg is required in order for it to work with JAVA-8. It works fine with JAVA-7)
推荐答案
这与新的 JAXB 1.5 中的 XML 安全属性,在 Java 8 中引入.这就是您的构建现在在 Java 8 上失败但可以在 Java 7 上工作的原因.
This is relevant to the new XML security properties in JAXB 1.5, introduced in Java 8. This is why your builds now fail on Java 8 but work with Java 7.
如果您使用的是我的maven-jaxb2-plugin
,请升级到0.9.0
或更高版本(当前为0.10.0
代码>).它现在有一个 accessExternalSchema
开关(默认为 all
).
If you're using my maven-jaxb2-plugin
, please upgrade to the version 0.9.0
or later (current is 0.10.0
). It has now a accessExternalSchema
switch (default is all
).
这精确地设置了javax.xml.accessExternalSchema=all
.
请参阅文档一>.
这篇关于如何为 JAXB2 Maven 插件指定 javax.xml.accessExternalSchema的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!