When running mvn clean install I get the following error that the external files can't be reached.
schema_reference: Failed to read schema document 'xml.xsd', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
This behaviour is as intended as I want my resources to be local. But shouldn't the catalog change avoid this error? Or is there something wrong with my config?
Parts of the pom file:
<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>
Catalog file:
<!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>
After a whole lot of experimenting I found out that mye catalog was wrong. The use of
<property>
<name>javax.xml.accessExternalSchema</name>
<value>file</value>
</property>
<property>
<name>javax.xml.accessExternalDTD</name>
<value>file</value>
</property>
was dropped and I changed my catalog to catalog.cat file, form catalog.xml, to this:
REWRITE_SYSTEM "http://www.w3.org" "www.w3.org"
REWRITE_SYSTEM "http://docs.oasis-open.org" "docs.oasis-open.org"
REWRITE_URI "http://docs.oasis-open.org/wsn" "docs.oasis-open.org/wsn"
REWRITE_URI "http://docs.oasis-open.org/wsrf" "docs.oasis-open.org/wsrf"
The properties mentioned above does work with this catalog, but I droped it since with a working catalog, maven does not fetch any external schemas as long as the path in the catalog is correct. Making the properties obsolete.