[英]Maven maven-jaxb2-plugin and HTTP 302
我正在使用Maven 3.3.3和maven-jaxb2-plugin版本0.12.1從XSD架構生成Java類。 XSD所在的地址返回HTTP 302,插件拋出:
[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'.
是否可以指定xjc編譯器遵循302到正確的鏈接,以及如何去嘗試下載XSD,以及如何指定?
我通過使用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>
然后在我的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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.