簡體   English   中英

jaxb2 maven插件,在單獨的標簽中定義多個模式文件

[英]jaxb2 maven plugin, define multiple schema files in separate tags

我正在使用maven jaxb2插件從xsd文件生成Java類。 最近我遇到了問題,我的架構文件列表確實很長,並且我在shemaFiles標簽中將它們全部寫為逗號分隔值,並且該行本身非常長,我擔心將來它會影響代碼可讀性並且是一個錯誤的原因。 那么有什么解決方案可以在單獨的標簽中寫入文件,例如:

<schemaFilesList>
  <schemaFile>SharedResources/xsd/Common.xsd</schemaFile>
  <schemaFile>SharedResources/xsd/Another.xsd</schemaFile>
          .... 
 </schemaFilesList>

這是我現在的代碼:

<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>

提前致謝。

我們也有很多架構。 我們簡單地省略<schemaFiles>元素,讓它讀取<schemaDirectory>中的所有模式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM