3

我似乎无法弄清楚如何控制由 maven-jaxb-schemagen-plugin 创建的 XSD 文件的文件名。文档有点稀疏。

        <groupId>com.sun.tools.jxc.maven2</groupId>
        <artifactId>maven-jaxb-schemagen-plugin</artifactId>
        <version>1.2</version>
        <configuration>
           <project>${project}</project>
           <destdir>${project.build.directory}/generated-resources/schemas</destdir>
           <srcdir>${project.build.sourceDirectory}/my/jaxb/bean/package</srcdir>
           <verbose>true</verbose>
        </configuration>

它似乎总是创建一个名为 schema1.xsd 的文件

4

1 回答 1

4

您需要添加描述哪个文件应包含您拥有的每个命名空间的元素的架构元素:

<configuration>
    [...]
    <schemas>
       <schema>
          <namespace>http://www.example.invalid/2001/05/27/wibble</namespace>
          <file>wibble.xsd</file>
       </schema>
    </schemas>
<configuration>

假设您已经设置了组件的命名空间

@XmlRootElement(name = "wobble", namespace="http://www.example.invalid/2001/05/27/wibble")
于 2011-05-27T10:29:17.357 回答