3

tl;dr:-Dでは、システム プロパティの定義を移動して、pom.xmlファイル内に内部化する方法はありますか?


現在、ビルドが機能するように-Djavax.xml.accessExternalSchema=allコマンドラインから渡しています。プラグイン ( jaxb2-maven-pluginmvn clean install -Djavax.xml.accessExternalSchema=all 1.6)でオプションを渡すことができません。これは、使用しているバージョンがこれをサポートしておらず、サポートしているバージョンでは構成を完全に変更する必要があり、承認を得られないためです。

タグの下に追加することにより、他の場所で提案されている<properties>ように、タグを使用する値を設定しようとしています:<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.
4

2 に答える 2

8

はい、フェーズ中に設定される目標を使用して、 Properties Maven プラグインを使用できます。set-system-propertiesinitialize

<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>
于 2015-12-17T16:54:08.433 に答える