title: maven-jaxb2-plugin reusing commons XSD within same project
body: <p>I have a project which has a schema A and B, both within the same namespace. Both import schema C which also uses the same namespace. How can I generate JAXB classes for A and B to separate packages, while reusing the JAXB classes from C generated to a commons package?</p>
  
  <p>I already know I should probably be using episodes and use the episode generated for schema C as bindings file for the separate executions of schema's A and B. Problem is I don't know how to refer to this generated episode file.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt;
      &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt;
      &lt;version&gt;0.12.3&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;generate-sources-C&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;generate&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;generatePackage&gt;com.mymodel.commons&lt;/generatePackage&gt;
                  &lt;generateDirectory&gt;${project.build.directory}/generated-sources/xjc-commons&lt;/generateDirectory&gt;
                  &lt;schemas&gt;
                      &lt;schema&gt;&lt;url&gt;src/main/resources/xsd/mymodel/c.xsd&lt;/url&gt;&lt;/schema&gt;
                  &lt;/schemas&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
              &lt;id&gt;generate-sources-A&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;generate&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;generatePackage&gt;com.mymodel.a&lt;/generatePackage&gt;
                  &lt;schemas&gt;
                      &lt;schema&gt;&lt;url&gt;src/main/resources/xsd/mymodel/a.xsd&lt;/url&gt;&lt;/schema&gt;
                  &lt;/schemas&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
              &lt;id&gt;generate-sources-B&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;generate&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;generatePackage&gt;com.mymodel.b&lt;/generatePackage&gt;
                  &lt;schemas&gt;
                      &lt;schema&gt;&lt;url&gt;src/main/resources/xsd/mymodel/b.xsd&lt;/url&gt;&lt;/schema&gt;
                  &lt;/schemas&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>This causes an episode file to be created under: </p>
  
  <pre><code>target/generated-sources/xjc-commons/META-INF/sun-jaxb.episode
  </code></pre>
  
  <p>How do I refer to this episode/bindings file in executions for A and B? <a href="https://github.com/highsource/maven-jaxb2-plugin/wiki/Using-Episodes" rel="noreferrer">Using Episodes</a> only mentions how to refer to an episode file from other jar dependencies (or I simply didn't understand it properly, which is more likely).</p>
  
  <p>I've seen an older answer suggest to <a href="https://stackoverflow.com/a/11135186/441662">pass it as a parameter <code>-b</code></a> to XJC, but that didn't seem to do anything for me. I still end up with the same class from C generated three times.</p>