引用位于不同项目模块中的不同 XML 的 XSD 文件?

发布于 2024-09-13 16:52:35 字数 335 浏览 4 评论 0原文

我有一个 XSD 文件,在不同项目模块的三个不同 XML 文件中引用,使用:

<item-groups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xml_schemas/item_groups.xml.xsd">

我一直在尝试弄清楚如何避免手动将 XSD 复制到需要它的每个模块中,因此我不必维护三个文件之一。

Maven 有没有一种方法可以让我的一个模块中只有一个版本,并在构建时将其复制到其他两个模块?

谢谢!

I have an XSD file that is referenced in three different XML files in different project modules using:

<item-groups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xml_schemas/item_groups.xml.xsd">

I have been trying to figure how to avoid manually copying the XSD into every module that needs it, so I don't have to maintain three files instead of one.

Is there a way in maven that I can have only one version in one of my modules, and at build time it copies it over to the other two?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小梨窩很甜 2024-09-20 16:52:35

假设 XSD 至少打包在一个模块中,那么应该可以使用 Maven Dependency 插件和 依赖项:解包。这个想法是将目标绑定在generate-resources上,从包含它的模块中解压XSD(使用includes来准确地获取你想要的内容)并在需要的地方编写它。请参阅解压特定工件以获取完整信息例子。

Assuming the XSD is packaged in at least one module, it should be possible to achieve what you want with the Maven Dependency plugin and dependency:unpack. The idea would be to bind the goal on generate-resources to unpack the XSD from the module having it (using includes to pick up exactly what you want) and write it where required. See the Unpacking specific artifacts for a full example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文