title: Excluding xsd element from unmarshalling if already created?
body: <p>I am getting below error while maven build using jaxb(maven-jaxb2-plugin) compiler</p>
  
  <pre><code>A class/interface with the same name "org.somePackage.customer" is already in use.
      Use a class customization to resolve this conflict.
          at com.sun.tools.xjc.util.CodeModelClassFactory.createClass(CodeModelClassFactory.java:121)
          at com.sun.tools.xjc.util.CodeModelClassFactory.createClass(CodeModelClassFactory.java:82)
          at com.sun.tools.xjc.generator.bean.ImplStructureStrategy$1.createClasses(ImplStructureStrategy.java:82)
          at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassDef(BeanGenerator.java:437)
          at com.sun.tools.xjc.generator.bean.BeanGenerator.getClazz(BeanGenerator.java:469)
          at com.sun.tools.xjc.generator.bean.BeanGenerator.&lt;init&gt;(BeanGenerator.java:194)
          at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:166)
          at com.sun.tools.xjc.model.Model.generateCode(Model.java:290)
          at org.jvnet.mjiip.v_2_2.XJC22Mojo.generateCode(XJC22Mojo.java:70)
  </code></pre>
  
  <p>Relevant XSD code snippet because of which error is coming</p>
  
  <pre><code> &lt;xsd:element name="customer" &gt;
           ........
   &lt;/xsd:element&gt;
   &lt;xsd:element name="permanentCustomer" type="customer"/&gt;
  </code></pre>
  
  <p>Relevant pom section for maven-jaxb2-plugin is </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.8.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;schemaDirectory&gt;src/main/resources/META-INF/schema&lt;/schemaDirectory&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>What works</strong> </p>
  
  <p>If I introduce  <code>block="substitution"</code> it works</p>
  
  <pre><code>&lt;xsd:element name="customer" block="substitution"&gt;
   ........
  &lt;/xsd:element&gt;
  &lt;xsd:element name="permanentCustomer" type="customer"/&gt;
  </code></pre>
  
  <p>After doing research on net,My guess is jaxb compiler again trying to create the customer class based on element <code>name="permanentCustomer"</code> which it has already created based on element <code>name ="customer".</code> So I don't want to create java object for permanentCustomer while unmarshalling as it has been already created while customer creation. </p>
  
  <p><strong>I can think of two solutions</strong> </p>
  
  <p>1)Some configuration For maven-jaxb2-plugin plugin  where if java class has been already generated, don't to regenerate it again and proceed</p>
  
  <p>2)Or Mentioning some attribute at xml level to ignore specific elements ?</p>
  
  <p>Is there any configuration exists ?</p>