Reputation: 2583
I'm using Maven 3.3.3 and maven-jaxb2-plugin version 0.12.1 to generate java classes from XSD schema. The address where the XSD is returns HTTP 302 and the plugin throws:
[ERROR] Error while parsing schema(s).Location [ http://www.gzs.si/e-poslovanje/sheme/eSlog_1-5_EnostavniRacun_signature.xsd{1,30}].
org.xml.sax.SAXParseException; systemId: http://www.gzs.si/e-poslovanje/sheme/eSlog_1-5_EnostavniRacun_signature.xsd; lineNumber: 1; columnNumber: 30; s4s-elt-character: Non-whitespace characters are not allowed in schema elements o
ther than 'xs:appinfo' and 'xs:documentation'. Saw 'Document Moved'.
Is is possible to specify, and how, that the xjc compiler follows 302 to the correct link or not to go and try downloading the XSD?
Upvotes: 0
Views: 784
Reputation: 43709
Disclaimer: Author of the maven-jaxb2-plugin here.
You're hitting the following problem:
Which is by design.
Your solution with catalogs is the right one. But you most probably don't need ClasspathCatalogResolver
.
Upvotes: 1
Reputation: 2583
I solved this by using a catalog.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteSystem systemIdStartString="http://www.gzs.si" rewritePrefix="https://www.gzs.si"/>
</catalog>
and then in my pom.xml:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.1</version>
<executions>
...
</executions>
<configuration>
<strict>false</strict>
<catalog>src/main/resources/jaxb/catalog.xml</catalog>
<catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
<generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
<verbose>true</verbose>
</configuration>
</plugin>
Upvotes: 0