title: JAXB2 Basics Plugins - Issue with schemaLocation in my External binding customization file
body: <p>I am using JAXB to generate classes from my XSD file. I would like to have the classes that are generated implement a common interface. So I am trying out the JAXB2 Basics plugin with the <a href="http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html#wp148366" rel="nofollow">external binding file</a> approach to do this. This is my custom binding file:</p>
  
  <p><strong>customBindingFile.xjb</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;jxb:bindings version="1.0" 
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
    jxb:extensionBindingPrefixes="xjc"&gt;
  
      &lt;jxb:bindings schemaLocation="abc-api.xsd"&gt;
        &lt;jxb:bindings node="//xs:complexType[@name='MyClass']"&gt;
          &lt;inheritance:implements&gt;com.kuldeep.CommonInterface&lt;/inheritance:implements&gt; 
        &lt;/jxb:bindings&gt;
      &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>Following is my maven plugin in pom file for source generation:
  Note the comment <strong>added by me</strong> is the change I made to this existing plugin entry.</p>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
    &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt;
    &lt;version&gt;${cxf.plugin.version}&lt;/version&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;generate-sources&lt;/id&gt;
        &lt;phase&gt;generate-sources&lt;/phase&gt;
        &lt;configuration&gt;
  
        &lt;!-- **extensions and args added by me** --&gt;
          &lt;extensions&gt;
              &lt;extension&gt;org.jvnet.jaxb2_commons:jaxb2-basics:0.9.2&lt;/extension&gt;
          &lt;/extensions&gt;
          &lt;args&gt;
              &lt;arg&gt;-Xinheritance&lt;/arg&gt;
          &lt;/args&gt;
  
  
          &lt;sourceRoot&gt;${project.build.directory}/generated/cxf&lt;/sourceRoot&gt;
          &lt;defaultOptions&gt;
            &lt;bindingFiles&gt;
              &lt;bindingFile&gt;src/main/resources/jaxws_binding.xml&lt;/bindingFile&gt;
              &lt;bindingFile&gt;src/main/resources/jaxb_binding.xml&lt;/bindingFile&gt;
            &lt;/bindingFiles&gt;
          &lt;/defaultOptions&gt;
          &lt;wsdlOptions&gt;
            ......
            &lt;wsdlOption&gt;
              &lt;wsdl&gt;${project.build.directory}/generated/framework/cxf/abc-api-inline.wsdl&lt;/wsdl&gt;
  
              &lt;!-- **bindingFile added by me** --&gt;
              &lt;bindingFile&gt;src/main/resources/customBindingFile.xjb&lt;/bindingFile&gt;
  
            &lt;/wsdlOption&gt;
          &lt;/wsdlOptions&gt;
        &lt;/configuration&gt;
        &lt;goals&gt;
          &lt;goal&gt;wsdl2java&lt;/goal&gt;
        &lt;/goals&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  
    &lt;!-- **dependency added by me** --&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.jvnet.jaxb2_commons&lt;/groupId&gt;
        &lt;artifactId&gt;jaxb2-basics&lt;/artifactId&gt;
        &lt;version&gt;0.9.2&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
  &lt;/plugin&gt;
  </code></pre>
  
  <p>The issue that I have is my schema file <strong>abc-api.xsd</strong> resides in some other project, so when I try to do maven install to generate my classes, I get error saying <strong>abc-api.xsd is not a part of this compilation</strong>.</p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal
    org.apache.cxf:cxf-codegen-plugin:3.0.3:wsdl2java (generate-sources)
    on project : Execution generate-sources of goal
    org.apache.cxf:cxf-codegen-plugin:3.0.3:wsdl2java failed:
    file:/I:/project/src/main/resources/customBindingFile.xjb [9,56]:
    "file:/I:/project/src/main/resources/abc-api.xsd" is not a part of
    this compilation. Is this a mistake for
    "file:/I:/project/src/main/resources/jaxb_binding.xml"? -> [Help 1]</p>
  </blockquote>
  
  <p>And if I remove the schemaLocation attribute from <em>customBindingFile.xjb</em> it does not work and gives error:</p>
  
  <blockquote>
    <p>XPath evaluation of "//xs:complexType[@name='MyClass']" results in
    empty target node</p>
  </blockquote>
  
  <p>So my question is how can I avoid providing the specific schema file name/location in <em>customBindingFile.xjb</em> and just have it applied to whatever xsd it's using to generate the classes.</p>