title: JAXB Bindings to schemas in a JAR
body: <p>I'm using the maven jaxb2 plugin to generate Java classes, built from schemas in a jar. However, I'm not sure how to correctly locate to these schemas from a bindings file. If Iextract the schemas from the jar and drop them in the same directory as the bindings, all is well. However, this isn't a practical long term solution.</p>
  
  <p>pom.xml:</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.1&lt;/version&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;configuration&gt;
      &lt;schemas&gt;
       &lt;schema&gt;
        &lt;dependencyResource&gt;
         &lt;groupId&gt;com.test&lt;/groupId&gt;
         &lt;artifactId&gt;schemas&lt;/artifactId&gt;
         &lt;version&gt;1.10-SNAPSHOT&lt;/version&gt;
         &lt;resource&gt;schemas/schema.xsd&lt;/resource&gt;
        &lt;/dependencyResource&gt;
       &lt;/schema&gt;
      &lt;/schemas&gt;              
      &lt;bindingDirectory&gt;bindings&lt;/bindingDirectory&gt;
      &lt;generatePackage&gt;test.package&lt;/generatePackage&gt;
      &lt;bindingIncludes&gt;
       &lt;include&gt;*.xml&lt;/include&gt;
      &lt;/bindingIncludes&gt;
      &lt;extension&gt;true&lt;/extension&gt;
     &lt;/configuration&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>bindings.xml:</p>
  
  <pre><code>&lt;jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
   xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb ./bindingschema_2_1.xsd"
   version="2.1"&gt;
  
  &lt;jxb:bindings schemaLocation="classpath:/schemas/schema.xsd" node="/xs:schema"&gt;
    &lt;jxb:bindings node="//xs:complexType[@name='AbstractChangeable']"&gt;
     &lt;jxb:class implClass="com.test.AbstractEntity" /&gt;
    &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>