title: JAXB: Generating classes for two XSDs which share a common XSD
body: <p>I have 2 service XSD files AService.xsd and BService.xsd each with different targetNamespace. Both of these use a common XSD called common.xsd. I use the JAXB Maven plugin to generate classes. Here's how,</p>
  
  <pre><code>&lt;execution&gt;
      &lt;id&gt;generate-package&lt;/id&gt;
      &lt;goals&gt;
          &lt;goal&gt;generate&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
          &lt;extension&gt;true&lt;/extension&gt;
          &lt;schemaIncludes&gt;
              &lt;include&gt;schema/Aservice.xsd&lt;/include&gt;
              &lt;include&gt;schema/Bservice.xsd&lt;/include&gt;                             
          &lt;/schemaIncludes&gt;
          &lt;bindingIncludes&gt;                                   
              &lt;include&gt;schema/*.xjb&lt;/include&gt;
          &lt;/bindingIncludes&gt;
          &lt;generatePackage&gt;com.schema&lt;/generatePackage&gt;
          &lt;generateDirectory&gt;src/main/java&lt;/generateDirectory&gt;
      &lt;/configuration&gt;
  &lt;/execution&gt;
  </code></pre>
  
  <p>When i try to run this i get the following error. <code>ValidationType</code> is defined in common.xsd</p>
  
  <pre><code>org.xml.sax.SAXParseException: A class/interface with the same name "com.schema.ValidationType" is already in use. Use a class customization to resolve this conflict.
  ..........
  org.xml.sax.SAXParseException: (Relevant to above error) another "ValidationType" is generated from here.
  ......
  com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory class.
  </code></pre>
  
  <p>If i run the 2 service xsds in 2 different executions generating into 2 different packages, i get the same <code>ValidationType</code> class in 2 different packages. </p>
  
  <p>Any ideas on how to make JAXB recognize shared schemas?</p>