我有两个项目:
xsdproject/
src/main/resources/
a.xsd
b.xsd
implproject/
在implproject中,我想使用maven-jaxb2-plugin从xsd生成类。
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<cleanPackageDirectories>true</cleanPackageDirectories>
<forceRegenerate>true</forceRegenerate>
<schemas>
<schema>
<dependencyResource>
<groupId>some.group</groupId>
<artifactId>xsdproject</artifactId>
<version>${project.version}</version>
<resource>a.xsd</resource>
</dependencyResource>
</schema>
<schema>
<dependencyResource>
<groupId>some.group</groupId>
<artifactId>xsdproject</artifactId>
<version>${project.version}</version>
<resource>b.xsd</resource>
</dependencyResource>
</schema>
</schemas>
</configuration>
</plugin>
问题出在这里 -> b.xsd 文件中有
<xs:include schemaLocation="a.xsd" />
在生成过程中,我遇到了一个错误:
Failed to read schema document 'a.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>.
有没有一种成功导入两个XSD并编译它们的方法?