title: Want @XmlRootElement in classes generated by jaxb2-maven-plugin
body: <p>I have one set of Java classes generated from a WSDL that work fine; I'm adding another WSDL to the project for another webservice I'm using, but I get no @XmlRootElement annotations in the generated classes from the second WSDL, and don't understand why not.</p>
  
  <p>Here's the plugin portion of the pom:</p>
  
  <pre><code>        &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
            &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.2&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;xjc&lt;/id&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;xjc&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;sourceType&gt;wsdl&lt;/sourceType&gt;
                &lt;sources&gt;
                    &lt;source&gt;${resources.path}my-module/src/main/resources/wsdl/w1.wsdl&lt;/source&gt;
                    &lt;source&gt;${resources.path}my-module/src/main/resources/wsdl/w2.wsdl&lt;/source&gt;
                &lt;/sources&gt;
                &lt;extension&gt;true&lt;/extension&gt;
                &lt;xjbSources&gt;
                    &lt;xjbSource&gt;src/main/resources/xjb/bindings.xjb&lt;/xjbSource&gt;
                &lt;/xjbSources&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>And here's bindings.xjb:</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:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
                jxb:extensionBindingPrefixes="xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;jxb:bindings&gt;
          &lt;!-- annotate tag here? --&gt;
          &lt;jxb:globalBindings&gt;
              &lt;xjc:simple/&gt;
          &lt;/jxb:globalBindings&gt;
      &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>I read in <a href="https://stackoverflow.com/questions/18665053/generating-java-classes-using-maven-jaxb2-plugin" title="this">this</a> SO post about using an <code>annotate</code> tag, so I inserted </p>
  
  <pre><code>        &lt;annox:annotate&gt;
              &lt;annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" /&gt;
          &lt;/annox:annotate&gt;
  </code></pre>
  
  <p>at the indicated place in the bindings.xjb file, but of course I don't have a definition for the <code>annox</code> prefix, so that doesn't work. The post doesn't indicate where that's defined.</p>
  
  <p>I've also been through multiple answers in <a href="https://stackoverflow.com/questions/819720/no-xmlrootelement-generated-by-jaxb">this</a> SO post; unfortunately the various methods each leave out some steps. For instance, I'm willing to call marshall and unmarshall methods directly, but I need to know where to get the "JAXBContext" they speak of, and what the unmarshall call looks like, or where to look it up.</p>
  
  <p>Is <code>annox</code> the correct way to do this? Is there another correct way to do this?</p>