我有一个maven插件(jaxb2),我需要为它提供一个jvm。我不认为在pom中有为它添加jvm参数的标签。
我知道我可以在命令行中传入jvm参数,例如:mvn clean install -Djavax.xml.accessExternalSchema=all
有没有可能在pom中设置这个jvm arg,这样我就不必每次都在命令行中输入它?
(另外-此jvm arg是与JAVA-8协同工作所必需的。它在JAVA-7上工作得很好)
发布于 2014-10-14 06:29:36
这与Java8中引入的新XML security properties in JAXB 1.5相关,这就是为什么您的构建现在在Java8上失败,但可以在Java7上工作。
如果您使用的是my maven-jaxb2-plugin
,请升级到0.9.0
或更高版本(当前为0.10.0
)。它现在有一个accessExternalSchema
开关(默认是all
)。
这就精确地设置了javax.xml.accessExternalSchema=all
。
请参阅documentation。
发布于 2015-01-08 00:23:21
我在使用jaxb2-maven-plugin时遇到了这个问题。我发现了一个与maven-jabx2-plugin - https://java.net/projects/maven-jaxb2-plugin/lists/issues/archive/2014-03/message/0相关的jira问题。
根据这个问题,Stephan202建议使用properties-maven-plugin,它的工作方式很像charm。以下是他的帖子中的示例代码-
<plugin>
<!-- We use this plugin to ensure that our usage of the
maven-jaxb2-plugin is JDK 8 compatible in absence of a fix
for https://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-80. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<id>set-additional-system-properties</id>
<goals>
<goal>set-system-properties</goal>
</goals>
</execution>
</executions>
<configuration>
<properties>
<property>
<name>javax.xml.accessExternalSchema</name>
<value>file,http</value>
</property>
</properties>
</configuration>
</plugin>
发布于 2016-01-23 00:25:02
Re;帖子-“我需要一个不使用alpha版本的解决方案,因为这是我公司的规则。”
将版本改为1.0,并将值改为'all‘,这样我就可以使用它了:
<plugin>
<!-- We use this plugin to ensure that our usage of the
maven-jaxb2-plugin is JDK 8 compatible in absence of a fix
for https://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-80. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<!--
<version>1.0-alpha-2</version> -->
<version>1.0.0</version>
<executions>
<execution>
<id>set-additional-system-properties</id>
<goals>
<goal>set-system-properties</goal>
</goals>
</execution>
</executions>
<configuration>
<properties>
<property>
<name>javax.xml.accessExternalSchema</name>
<value>all</value>
</property>
</properties>
</configuration>
</plugin>
https://stackoverflow.com/questions/26344590
复制相似问题