My goal is to generate a java code from XSD using maven-jaxb2-plugin, and in particular from 3 separate schemas. The problem I am facing is that all schemas have dependency on a common schema and the same classes are generated three times.
The part of the pom I am using is shown below:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc-a</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>com.a</packageName>
<schemaDirectory>src/main/resources/a</schemaDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>xjc-b</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>com.b</packageName>
<schemaDirectory>src/main/resources/b</schemaDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>xjc-c</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>com.c</packageName>
<schemaDirectory>src/main/resources/c</schemaDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
</plugin>
Schemas a, b, c all include a common schema, say d. When the sources are generated class from d are generated in each package and what I wish to do is to factor out the common classes into a separate package. Thanks