【发布时间】:2015-09-11 23:08:28
【问题描述】:
我正在使用maven-jaxb2-plugin 并且我的 .xsd 文件处于 maven 依赖项中。文档显示您在这样的 Maven 依赖项中指定 .xsd
<schema>
<!-- Specifies a schema from the Maven artifact. -->
<dependencyResource>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-tests-po</artifactId>
<!-- Version of the artifact. May be omitted.
The plugin will then try to find the version using
the dependencyManagement and dependencies of the project. -->
<version>${project.version}</version>
<!-- Path of the resource within the artifact. -->
<resource>purchaseorder.xsd</resource>
</dependencyResource>
</schema>
我想对依赖 .jar 文件中的所有 .xsd 文件运行 xjc。 .xsd 文件位于 .jar 文件中的不同目录中。这个我试过了
<resource>**/*.xsd</resource>
但由于此异常而失败
org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'maven:com.dg:XSD:jar::5.0.3.4!/**/*.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>.
有没有办法在 mvn 依赖项中指定所有位于不同目录中的 .xsd 文件?
另外,xjc 是否可以在一组 .xsd 文件上整理出一个依赖树,其中一个 .xsd 文件依赖于另一个文件,而另一个文件可能依赖于另一个文件,...?
谢谢。
【问题讨论】:
标签: jaxb jaxb2 xjc maven-jaxb2-plugin