title: Unable to execute wsdl2java with maven
body: <p>I want to execute wsdl2java with maven but I have the following build failure :</p>
  
  <pre><code>    [INFO] --- maven-dependency-plugin:2.1:copy (default) @ mogopay ---
  [INFO] Configured Artifact: javax.xml.bind:jaxb-api:2.2:jar
  [INFO] Configured Artifact: javax.xml.ws:jaxws-api:2.2:jar
  [INFO] Copying jaxb-api-2.2.jar to c:\Users\EBIZNEXT\git\mogopay-core\mogopay\target\endorsed\jaxb-api-2.2.jar
  [INFO] Copying jaxws-api-2.2.jar to c:\Users\EBIZNEXT\git\mogopay-core\mogopay\target\endorsed\jaxws-api-2.2.jar
  [INFO]
  [INFO] --- maven-antrun-plugin:1.3:run (copy-tomcat-resources) @ mogopay ---
  [INFO] Executing tasks
  [INFO] Executed tasks
  [INFO]
  [INFO] --- cxf-codegen-plugin:2.4.2:wsdl2java (CXF Payline) @ mogopay ---
  [INFO] Running wsdl2java in fork mode...
  [INFO] Building jar: C:\Users\EBIZNEXT\AppData\Local\Temp\cxf-tmp-679212\cxf-codegen5225275003143491559.jar
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1:30.351s
  [INFO] Finished at: Tue Jan 22 18:28:57 CET 2013
  [INFO] Final Memory: 14M/178M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.4.2:wsdl2java (CXF Payline) on project mogopay:
  [ERROR] Exit code: 1 - Exception in thread "main" org.apache.cxf.tools.common.ToolException: java.lang.reflect.UndeclaredThrowableException
  [ERROR] at
     ...
  [ERROR] Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
  [ERROR] at java.lang.Class.getDeclaredMethod(Class.java:1954)
  [ERROR] at com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.java:107)
  [ERROR] ... 27 more
  [ERROR]
  [ERROR] Command line was: "c:\Program Files\Java\jdk1.7.0\jre\bin\java.exe" -Djava.endorsed.dirs=c:\Users\EBIZNEXT\git\mogopay-core\mogopay\target/endorsed -jar
   C:\Users\EBIZNEXT\AppData\Local\Temp\cxf-tmp-679212\cxf-codegen5225275003143491559.jar C:\Users\EBIZNEXT\AppData\Local\Temp\cxf-tmp-679212\cxf-w2j3628405823287
  641812args
  </code></pre>
  
  <p>This project is built in grails 2.0.3. It seems that the problem comes from Jaxb because the current version in grails uses jaxb-api-2.1 while the project needs jaxb 2.2. I have updated my pom as it has been suggested from this answer : <a href="https://stackoverflow.com/questions/5654534/set-java-compliance-level-in-cxf-wsdl2java">Set Java Compliance Level in CXF wsdl2java</a> and also here : <a href="http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html" rel="nofollow noreferrer">Example 7 - Using JAXB/JAX-WS 2.2 with Java 6</a>. But when I execute maven command : <code>mvn clean install</code>, I get the error above. </p>
  
  <p>Here is my pom (I removed the unimportant parts): </p>
  
  <pre><code>&lt;pluginManagement&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;compilerArguments&gt;
                          &lt;endorseddirs&gt;${project.build.directory}/endorsed&lt;/endorseddirs&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;forkMode&gt;once&lt;/forkMode&gt;
                      &lt;argLine&gt;-Djava.endorsed.dirs=${project.build.directory}/endorsed&lt;/argLine&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
  
           &lt;plugins&gt;
               ...
               &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;artifactItems&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
                                  &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
                                  &lt;version&gt;2.2&lt;/version&gt;
                              &lt;/artifactItem&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;javax.xml.ws&lt;/groupId&gt;
                                  &lt;artifactId&gt;jaxws-api&lt;/artifactId&gt;
                                  &lt;version&gt;2.2&lt;/version&gt;
                              &lt;/artifactItem&gt;
                          &lt;/artifactItems&gt;
                          &lt;outputDirectory&gt;${project.build.directory}/endorsed&lt;/outputDirectory&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt; 
                  ...
                 &lt;plugin&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.4.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;fork&gt;once&lt;/fork&gt;
                  &lt;additionalJvmArgs&gt;-Djava.endorsed.dirs=${project.build.directory}/endorsed&lt;/additionalJvmArgs&gt;
              &lt;/configuration&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;xerces&lt;/groupId&gt;
                      &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
                      &lt;version&gt;2.8.1&lt;/version&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
                      &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
                      &lt;version&gt;2.2&lt;/version&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
                      &lt;artifactId&gt;jaxb-xjc&lt;/artifactId&gt;
                      &lt;version&gt;2.2&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;CXF Payline&lt;/id&gt;
                      &lt;phase&gt;process-resources&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;sourceRoot&gt;${basedir}/src/java&lt;/sourceRoot&gt;
                          &lt;wsdlOptions&gt;
                              &lt;wsdlOption&gt;
                                  &lt;wsdl&gt;${basedir}/src/java/wsdl/Payline_DirectPaymentAPI.wsdl&lt;/wsdl&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;/plugin&gt;                
           &lt;/plugins&gt;
  </code></pre>
  
  <p>Any suggestion would be appreciated</p>