如何告诉maven-jaxb2-plugin在maven依赖项中的所有.xsd文件上运行xjc? [英] How do I tell the maven-jaxb2-plugin to run xjc on all .xsd files in a maven dependency?

查看:779
本文介绍了如何告诉maven-jaxb2-plugin在maven依赖项中的所有.xsd文件上运行xjc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 maven-jaxb2-plugin ,我的.xsd文件是在maven依赖。该文档显示您在maven依赖项中指定.xsd,如此

I'm using the maven-jaxb2-plugin and my .xsd files are in a maven dependency. The documentation shows that you specify a .xsd in a maven dependency like this

<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文件中的不同目录中。我试过这个

I want to run xjc on all .xsd files in the dependent .jar file. The .xsd files are in different directories within the .jar file. I've tried this

<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文件?

Is there a way to specify all .xsd files in a mvn dependency when they are in different directories?

此外,xjc可以在一组.xsd文件中排序依赖关系树,其中一个.xsd文件依赖于另一个.xsd文件可能依赖于另一个。...?

Also, can xjc sort out a dependency tree on a group of .xsd files where one .xsd file depends on another, which may depend on another, ...?

谢谢。

推荐答案


是有一种方法可以在mvn依赖项中指定所有.xsd文件在不同的目录中吗?

Is there a way to specify all .xsd files in a mvn dependency when they are in different directories?

不,你现在的那一刻我必须指定单独的模式文件。您不需要指定所有这些,只需指定根。
您可以随意提出问题

No, at the moment you'll have to specify individual schema files. You don't need to specify all of them, just the "root" ones. Feel free to file an issue for that.


此外,xjc可以在一组.xsd文件中排序依赖关系树,其中一个.xsd文件依赖于另一个.xsd文件可能依赖于另一个.xsd文件。 ..?

Also, can xjc sort out a dependency tree on a group of .xsd files where one .xsd file depends on another, which may depend on another, ...?

是的,XJC递归地解析模式依赖性。您可以编译一个大而深的模式林,我经常这样做

Yes, XJC resolves schema dependencies recursively. You can compile a large and deep schema forest, I'm doing this routinely.

这篇关于如何告诉maven-jaxb2-plugin在maven依赖项中的所有.xsd文件上运行xjc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆