title: How to generate classes from wsdl and xsd using maven cxc code gen without a connection to the server
body: <p>I would like to generate java classes using the Apache CXG Maven plugin (WSLD2Java) for generating web service clients.  </p>
  
  <p>I have a configuration that works, but when I am offline OR the server is not available the generate sources fails.</p>
  
  <blockquote>
    <p>The error is that it failed to create wsdl definition : from "wsdl
    location" ... Operation Timed Out.</p>
  </blockquote>
  
  <p>From what I gather the tool can't access the service and so it can not get the XSD and in turn fails.</p>
  
  <p>I have the WSDL and the XSD, how do I get the Maven plugin configured to use the local copies of the files rather than requesting extra data from the Server?</p>
  
  <p><strong>EDIT:</strong>
  I have got it "working" by editing the WSDL directly.  I amended the XSD Import tag to > refer to the XSD which is located in the same folder as the WSDL.</p>
  
  <p>Editing the WSDL solution seems hackie and I would prefer something I could configure.  Any thoughts?</p>
  
  <p>The POM file is setup as follows minus artefact id:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-frontend-jaxrs&lt;/artifactId&gt;
          &lt;version&gt;2.7.10&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.16&lt;/version&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt;
                      &lt;artifactId&gt;surefire-junit47&lt;/artifactId&gt;
                      &lt;version&gt;2.16&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
              &lt;configuration&gt;
                  &lt;includes&gt;
                      &lt;include&gt;**/*.class&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;exec&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;executable&gt;java&lt;/executable&gt;
                  &lt;arguments&gt;
                      &lt;argument&gt;-classpath&lt;/argument&gt;
                      &lt;classpath /&gt;
                  &lt;/arguments&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;CXF&lt;/id&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
                  &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
                  &lt;version&gt;2.7.10&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
                  &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
                  &lt;version&gt;2.7.10&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
          &lt;build&gt;
              &lt;plugins&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.7.10&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;phase&gt;generate-sources&lt;/phase&gt;
                              &lt;goals&gt;&lt;goal&gt;wsdl2java&lt;/goal&gt;&lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;sourceRoot&gt;${basedir}/target/generated-sources&lt;/sourceRoot&gt;
                                  &lt;wsdlOptions&gt;
                                      &lt;wsdlOption&gt;
                                          &lt;wsdl&gt;${basedir}/src/main/resources/wsdls/WebService.wsdl&lt;/wsdl&gt;
                                          &lt;wsdlLocation&gt;classpath:WebService.wsdl&lt;/wsdlLocation&gt;
                                      &lt;/wsdlOption&gt;
                                  &lt;/wsdlOptions&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p></p>