運行mvn clean install時出現以下錯誤,無法訪問外部文件。accessExternalDTD屬性忽略目錄文件
schema_reference: Failed to read schema document 'xml.xsd', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
這種行爲是打算作爲我希望我的資源是本地的。但是,目錄變更不應該避免這個錯誤?或者我的配置有問題嗎?
部分POM文件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<catalog>${project.basedir}/catalog.xml</catalog>
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
<plugin>
<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</value>
</property>
<property>
<name>javax.xml.accessExternalDTD</name>
<value>file</value>
</property>
</properties>
<outputFile/>
</configuration>
</plugin>
目錄文件:
<!DOCTYPE catalog
PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteSystem systemIdStartString="http://www.w3.org/XML/1998/namespace" rewritePrefix="www.w3.org"/>
</catalog>
有了這些屬性確實有幫助,因爲maven在系統嘗試不訪問外部模式時拋出一個錯誤,並且很難通過閱讀堆棧跟蹤來捕獲 – Bjerke