title: JAXB2 Maven Plugin cannot generate annotations or inject-code
body: <p>I currently have an ant task that does a great job of generating my domain objects from xsd and xjb binding files. It creates the annotations and injects code where I need it based upon a custom Plugin.</p>
  
  <p>Now I'm trying to move all of this to Maven and while I can generate the objects I cannot get the code to inject or add the annotations. My POM plugin entry is as follows:</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.0&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;bindingDirectory&gt;src/main/resources/jaxb/bindings&lt;/bindingDirectory&gt;
      &lt;generatePackage&gt;com.noush.web.domain.model.data&lt;/generatePackage&gt;
      &lt;extension&gt;true&lt;/extension&gt;
      &lt;verbose&gt;true&lt;/verbose&gt;
      &lt;args&gt;&lt;!-- &lt;arg&gt;-XtoString&lt;/arg&gt; --&gt;
          &lt;!-- I want to use commons-lang-plugin to generate toString but this can 
              wait &lt;arg&gt;-Xcommons-lang&lt;/arg&gt; &lt;arg&gt;-Xcommons-lang:ToStringStyle=SIMPLE_STYLE&lt;/arg&gt; --&gt;
          &lt;arg&gt;-Xannotate&lt;/arg&gt;
          &lt;arg&gt;-Xinject-code&lt;/arg&gt;
      &lt;/args&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;noush&lt;/groupId&gt;
              &lt;artifactId&gt;code-expander-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.jvnet.jaxb2_commons&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb2-basics-annotate&lt;/artifactId&gt;
              &lt;version&gt;0.6.0&lt;/version&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/configuration&gt;
  
  
   &lt;/plugin&gt;
  </code></pre>
  
  <p>The objects get created but without any injected code or annotations. The output doesn't give any indication that anything is wrong.</p>
  
  <p>If it helps here is my working ant config:</p>
  
  <pre><code> &lt;target name="defineXjcTask"&gt;
      &lt;taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="xjcLib" /&gt;
  &lt;/target&gt;
  
  &lt;target name="generateJaxb"&gt;
      &lt;xjc target="${build.generated}" package="${noushweb.domain.model.jaxb.package}"&gt;
          &lt;arg value="-verbose"/&gt;
          &lt;arg value="-extension"/&gt;
          &lt;arg value="-Xcommons-lang"/&gt;
          &lt;arg value="-Xcommons-lang:ToStringStyle=SIMPLE_STYLE"/&gt;
          &lt;arg value="-Xinject-code"/&gt;
          &lt;arg value="-Xannotate"/&gt;
          &lt;schema dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.data.filename}" /&gt;
          &lt;binding dir="${build.directory}/jaxb/bindings" includes="${matmWS.mmmws.binding.filename}"/&gt;
          &lt;produces dir="${build.generated}/${noushweb.domain.model.jaxb.package.dir}" includes="**/*.java" /&gt;
      &lt;/xjc&gt;
  &lt;/target&gt;
  
  &lt;path id="xjcLib"&gt;
      &lt;pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-xjc.jar" /&gt;
      &lt;pathelement location="${ib.dir}/jaxb-ri-2.0.5/lib/jaxb-api.jar" /&gt;
      &lt;pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jaxb-impl.jar" /&gt;
      &lt;pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/activation.jar" /&gt;
      &lt;pathelement location="${lib.dir}/jaxb-ri-2.0.5/lib/jsr173_1.0_api.jar" /&gt;
      &lt;pathelement location="../lib/stax-api-1.0-2.jar" /&gt;
      &lt;pathelement location="../lib/jaxb-commons-lang-plugin-2.2.jar" /&gt;
      &lt;pathelement location="${lib.dir}/commons-lang-2.4/lib/commons-lang-2.4.jar" /&gt;
      &lt;pathelement location="../lib/code-expander-plugin.jar" /&gt;
      &lt;pathelement location="../lib/jaxb2-basics-runtime-0.6.0.jar" /&gt;
      &lt;pathelement location="../lib/jaxb2-basics-tools-0.6.0.jar" /&gt;
      &lt;pathelement location="../lib/jaxb2-basics-annotate-0.6.0.jar" /&gt;
      &lt;pathelement location="../lib/annox-0.5.0.jar" /&gt;
      &lt;pathelement location="${lib.dir}/axis-1_4/lib/commons-logging-1.0.4.jar" /&gt;
      &lt;pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/hibernate-validator-4.1.0.Final.jar"/&gt;
      &lt;pathelement location="${lib.dir}/hibernate-validator-4.1.0.Final/validation-api-1.0.0.GA.jar"/&gt;
  &lt;/path&gt;
  </code></pre>
  
  <p>I guess I could use a antrun kind of setup but I was hoping I could get this to work.</p>
  
  <p>Any thoughts would be most welcome.</p>
  
  <p>Thanks
  Noush</p>