[英]Jaxb2-maven-plugin Error java11 schema_reference
使用 JDK11 運行 jaxb2-maven-plugin (2.5.0) 時出現錯誤。
pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<id>xjc_test</id>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>../a/b/c/myschema.xsd</source>
</sources>
<clearOutputDir>false</clearOutputDir>
<outputDirectory />
</configuration>
</execution>
</executions>
</plugin>
錯誤:
[ERROR] null [-1,-1]
org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'file:/home/userE/eclipse-workspace-201809/parent/testjaxb/home/userE/eclipse-workspace-201809/parent/a/b/c/myschema.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.5.0:xjc (xjc_test) on project xxx:
[ERROR] +=================== [XJC Error]
[ERROR] |
[ERROR] | 0: file:/home/userE/eclipse-workspace-201809/parent/a/b/c/myschema.xsd
[ERROR] |
[ERROR] +=================== [End XJC Error]
如果我在 pom.xml 中輸入了錯誤的源路徑,它會失敗,所以我可以假設它找到了正確的.xsd 文件。 我不明白 schema_reference,它來自哪里。
有關信息 my.xsd 看起來像:(他位於另一個項目上)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
...
</xs:schema>
嘗試像這樣引用 basedir:
..
<sources>
<source>${project.basedir}/src/main/resources/your_folder/your_xsd.xsd</source>
</sources>
..
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.