2016-04-04 12 views
0

複数のxs:element/classエントリを含む複数のxsdスキーマファイルがあります。私は成功したクラスを取得しています唯一のexecutionタグで実行している間、彼らがのpom.xml重複したクラスエントリを持つ複数のxsdスキーマを使用したクラスの生成

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>jaxb2-maven-plugin</artifactId> 
       <version>1.6</version> 
       <executions> 
        <execution> 
         <id>schema1</id> 
         <goals> 
          <goal>xjc</goal> 
         </goals> 
         <configuration> 
          <schemaDirectory>src/main/resources/xsd/schema1</schemaDirectory> 
          <schemaIncludes> 
           <include>schema1.xsd</include> 
          </schemaIncludes> 
          <packageName>com.schema1.rest.stub</packageName> 
         </configuration> 
        </execution> 
        <execution> 
         <id>schema2</id> 
         <goals> 
          <goal>xjc</goal> 
         </goals> 
         <configuration> 
          <schemaDirectory>src/main/resources/xsd/schema2</schemaDirectory> 
          <schemaIncludes> 
           <include>schema2.xsd</include> 
          </schemaIncludes> 
          <packageName>com.schema2.rest.stub</packageName> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

に以下の行を使用してクラスに変換してみました。しかし、2つ以上のスキーマまたはexecutionタグを含めると、最後のスキーマ "schema2"に対して作成されたクラスのみが表示され、 "schema1"では作成されません。

コマンドラインログで実行しているうちに、両方のスキーマでクラスが生成されていることがわかります。しかし結果として、古いパッケージを削除して再作成します。基本的に私は、最後のスキーマのクラスのみを持ち、他のスキーマは持っていません。

どうすれば解決できますか?

答えて

0

<clearOutputDir>false</clearOutputDir><configuration>タグで使用してください。

例:

<configuration> 
    <clearOutputDir>false</clearOutputDir> 
    <schemaDirectory>src/main/resources/xsd/schema2</schemaDirectory> 
    <schemaIncludes> 
     <include>schema2.xsd</include> 
    </schemaIncludes> 
    <packageName>com.schema2.rest.stub</packageName> 
</configuration> 
関連する問題