jaxb2 maven插件,在单独的标签中定义多个模式文件

Zyg*_*lis 3 java xsd jaxb2 maven-plugin maven-jaxb2-plugin

我正在使用 Maven jaxb2 插件从 xsd 文件生成 Java 类。最近我遇到了问题,我的模式文件列表变得非常长,我将它们全部写在shemaFiles标签中作为逗号分隔值,并且该行本身很长,我担心将来它会影响代码的可读性并成为错误原因。那么有没有什么解决方案可以将文件写入单独的标签中,例如:

<schemaFilesList>
  <schemaFile>SharedResources/xsd/Common.xsd</schemaFile>
  <schemaFile>SharedResources/xsd/Another.xsd</schemaFile>
          .... 
 </schemaFilesList>
Run Code Online (Sandbox Code Playgroud)

这是我现在的代码:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>jaxb2-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>xjc</goal>
      </goals>
      <configuration>
        <extension>true</extension>
        <schemaDirectory>target/xsd</schemaDirectory>
        <!-- I have really long list of files here, in different directories-->
        <schemaFiles>
           SharedResources/xsd/Common.xsd,SharedResources/xsd/Messaging/EmailService.xsd, .....
        </schemaFiles>
      </configuration>
    </execution>
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

提前致谢。

tdr*_*ury 5

我们也有很多模式。我们只需省略 <schemaFiles> 元素并让它读取 <schemaDirectory> 中的所有模式。