I have an XSD file that is referenced in three different XML files in different project modules using:
我有一个XSD文件,在不同的项目模块中使用以下三种不同的XML文件引用:
<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.
我一直试图想办法避免手动将XSD复制到需要它的每个模块中,因此我不必维护三个文件而不是一个。
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?
在maven中是否有一种方法可以在我的一个模块中只有一个版本,并且在构建时将它复制到另外两个版本中?
Thanks!
谢谢!
1 个解决方案
#1
0
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.
假设XSD至少打包在一个模块中,应该可以通过Maven Dependency插件和依赖项实现您想要的:unpack。我们的想法是将生成资源上的目标绑定到从具有它的模块中解压缩XSD(使用包括准确提取您想要的内容)并在需要时将其写入。有关完整示例,请参阅解压缩特定工件。
#1
0
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.
假设XSD至少打包在一个模块中,应该可以通过Maven Dependency插件和依赖项实现您想要的:unpack。我们的想法是将生成资源上的目标绑定到从具有它的模块中解压缩XSD(使用包括准确提取您想要的内容)并在需要时将其写入。有关完整示例,请参阅解压缩特定工件。