title: Using different package names for bindings and wsdl using the jaxws maven plugin
body: <p>We have a special requirement with our application: files generated <strong>against the wsdl</strong> should have <strong>a given package name</strong> and files <strong>generated against xsd files</strong> should have <strong>another package name</strong>.</p>
  
  <p>There does not seem to have a way to customize this with the jaxws maven plugin. Here is our current configuration:</p>
  
  <pre><code>    &lt;execution&gt;
          &lt;id&gt;wsimport-finderpro&lt;/id&gt;
          &lt;phase&gt;generate-sources&lt;/phase&gt;
          &lt;goals&gt;
              &lt;goal&gt;wsimport&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;configuration&gt;
              &lt;bindingDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd&lt;/bindingDirectory&gt;
              &lt;bindingFiles&gt;
                  &lt;bindingFile&gt;ServerResponse_login.xsd&lt;/bindingFile&gt;
                  &lt;bindingFile&gt;OpenDirectAccessSession.xsd&lt;/bindingFile&gt;
              &lt;/bindingFiles&gt;
              &lt;!--wsdls file directory --&gt;
              &lt;wsdlDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl&lt;/wsdlDirectory&gt;
              &lt;!-- which wsdl file --&gt;
              &lt;wsdlFiles&gt;
                  &lt;wsdlFile&gt;B2T_DataModel.asmx.wsdl&lt;/wsdlFile&gt;
              &lt;/wsdlFiles&gt;
              &lt;!-- Keep generated files --&gt;
              &lt;keep&gt;true&lt;/keep&gt;
              &lt;!-- Package name --&gt;
              &lt;packageName&gt;com.mycompany.world.worldlink.finderpro.ws&lt;/packageName&gt;
              &lt;!-- generated source files destination--&gt;
              &lt;sourceDestDir&gt;target/generated-code/src&lt;/sourceDestDir&gt;
              &lt;staleFile&gt;target/jaxws/fp/.staleFlag&lt;/staleFile&gt;
              &lt;target&gt;2.1&lt;/target&gt;
          &lt;/configuration&gt;
      &lt;/execution&gt;
  </code></pre>
  
  <p>Can anyone please advise?</p>
  
  <p><strong>edit 1</strong>: I came up with the following code:</p>
  
  <pre><code>            &lt;execution&gt;
                  &lt;id&gt;wsimport-finderpro-01&lt;/id&gt;
                  &lt;phase&gt;generate-sources&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;wsimport&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;bindingDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd&lt;/bindingDirectory&gt;
                      &lt;bindingFiles&gt;
                          &lt;bindingFile&gt;OpenDirectAccessSession.xsd&lt;/bindingFile&gt;
                      &lt;/bindingFiles&gt;
                      &lt;!--wsdls file directory --&gt;
                      &lt;wsdlDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl&lt;/wsdlDirectory&gt;
                      &lt;!-- which wsdl file --&gt;
                      &lt;wsdlFiles&gt;
                          &lt;wsdlFile&gt;B2T_DataModel.asmx.wsdl&lt;/wsdlFile&gt;
                      &lt;/wsdlFiles&gt;
                      &lt;!-- Keep generated files --&gt;
                      &lt;keep&gt;true&lt;/keep&gt;
                      &lt;!-- Package name --&gt;
                      &lt;packageName&gt;com.ids.world.worldlink.finderpro.xmlstubs&lt;/packageName&gt;
                      &lt;!-- generated source files destination--&gt;
                      &lt;sourceDestDir&gt;target/generated-code/src&lt;/sourceDestDir&gt;
                      &lt;staleFile&gt;target/jaxws/fp-01/.staleFlag&lt;/staleFile&gt;
                      &lt;target&gt;2.1&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
              &lt;execution&gt;
                  &lt;id&gt;wsimport-finderpro-02&lt;/id&gt;
                  &lt;phase&gt;generate-sources&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;wsimport&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;bindingDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd&lt;/bindingDirectory&gt;
                      &lt;bindingFiles&gt;
                          &lt;bindingFile&gt;GetAllMyEntityQuotes.xsd&lt;/bindingFile&gt;
                      &lt;/bindingFiles&gt;
                      &lt;!--wsdls file directory --&gt;
                      &lt;wsdlDirectory&gt;src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl&lt;/wsdlDirectory&gt;
                      &lt;!-- which wsdl file --&gt;
                      &lt;wsdlFiles&gt;
                          &lt;wsdlFile&gt;B2T_DataModel.asmx.wsdl&lt;/wsdlFile&gt;
                      &lt;/wsdlFiles&gt;
                      &lt;!-- Keep generated files --&gt;
                      &lt;keep&gt;true&lt;/keep&gt;
                      &lt;!-- Package name --&gt;
                      &lt;packageName&gt;com.ids.world.worldlink.finderpro.xmlstubs.allMyEntityQuotes&lt;/packageName&gt;
                      &lt;!-- generated source files destination--&gt;
                      &lt;sourceDestDir&gt;target/generated-code/src&lt;/sourceDestDir&gt;
                      &lt;staleFile&gt;target/jaxws/fp-02/.staleFlag&lt;/staleFile&gt;
                      &lt;target&gt;2.1&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
  </code></pre>
  
  <p>The issue is that I noticed that many classes are regenerated several times (here x2) and I end up with same classes in different packages.</p>
  
  <p><strong>How can I ensure that classes generated for the wsdl are generated once and classes for the xsd are generated and placed in their respective package</strong>?</p>