gpt4 book ai didi

maven - 是否有从 pom.xml 中设置 -D 参数的通用方法?

转载 作者:行者123 更新时间:2023-12-04 17:05:06 25 4
gpt4 key购买 nike

tl;dr: 那么,有没有办法移动 -D 的定义?系统属性并将其内部化到 pom.xml文件?


我们目前正在通过 -Djavax.xml.accessExternalSchema=all从命令行作为 mvn clean install -Djavax.xml.accessExternalSchema=all使我的构建工作。我无法通过插件 (jaxb2-maven-plugin 1.6) 中的选项,因为我们使用的版本不支持此功能,并且需要完全更改配置的版本,我们不会获得批准。

试图在<properties> 内设置使用标签的值喜欢 suggested elsewhere通过在 <project> 下添加标签:

<properties>
<javax.xml.accessExternalSchema>all</javax.xml.accessExternalSchema>
</properties>

但我仍然得到一个错误(在下面重现),而通过命令行传递它却没有。

Caused by: org.xml.sax.SAXParseException; 
systemId: jar:file:/e:/apache/maven/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.7/jaxb-xjc-2.2.7.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd;
lineNumber: 52; columnNumber: 88; schema_reference:
Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

最佳答案

是的,您可以使用 Properties Maven plugin使用 set-system-properties goal这将在 initialize phase 期间设置它.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>javax.xml.accessExternalSchema</name>
<value>all</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>

关于maven - 是否有从 pom.xml 中设置 -D 参数的通用方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34340115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com