title: Using JAXB in Eclipse to generate classes from XSD file, how do I ensure imported XSDs end up in a separate package?
body: <p>I have two schemas that I want to generate classes from. Each schema imports a common schema.</p>
  
  <p>The schema source directories are:</p>
  
  <ul>
  <li>common/types.xsd</li>
  <li>component/componentType.xsd</li>
  <li>deployment/deployment.xsd</li>
  </ul>
  
  <p>The latter two schemas import the first. Each schema has its own namespace, obviously. I would like each schema to end up in its own package with the types classes existing only in the common package. Every time I try it at the moment I get duplicated common classes. I have tried using a binding specification but without success, it just seems to be ignored.  I tried the following:</p>
  
  <pre><code>&lt;jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" &gt;
      &lt;jxb:bindings namespace="http://www.myorg.com/schemas/types" schemaLocation="common/types.xsd" &gt;
          &lt;jxb:schemaBindings&gt;
              &lt;jxb:package name="com.myorg.xml.common"/&gt;
          &lt;/jxb:schemaBindings&gt;
      &lt;/jxb:bindings&gt;
      &lt;jxb:bindings namespace="http://www.myorg.com/schemas/types" schemaLocation="component/componentType.xsd" &gt;
          &lt;jxb:schemaBindings&gt;
              &lt;jxb:package name="com.myorg.xml.common"/&gt;
          &lt;/jxb:schemaBindings&gt;
      &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>I am using Eclipse Juno and I have previously been generating the classes using "New"->"JAXB Classes from Schema". I am not using any custom build scripts etc. for the project, not only that, but I'm afraid that my limited knowledge of building means that understanding or writing custom Ant/Maven scripts is beyond me.</p>
  
  <p>Could someone possibly describe how to generate the classes such that the common classes are shared and using the Eclipse GUI "JAXB Classes from Schema"?</p>
  
  <p>Thank you in advance</p>