title: How do I link to XSD files using the Apache CXF Maven plugin?
body: <p>I'm using the Apache <code>cxf-codegen-plugin</code> Maven plugin to try and generate Java classes from a WSDL file. I get the following error:</p>
  
  <blockquote>
    <p><code>Part &lt;parameters&gt; in Message &lt;{http://www.foo.com/bar}PushCommandSoapIn&gt; referenced Type &lt;{http://www.foo.com/bar}CommandMessage&gt; can not be found in the schemas</code>            </p>
  </blockquote>
  
  <p>The type in question (<code>CommandMessage</code>) is defined in an XSD file that I've attempted to reference using the following POM file:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&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.11&lt;/version&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;generate-sources&lt;/id&gt;
        &lt;phase&gt;generate-sources&lt;/phase&gt;
        &lt;configuration&gt;
          &lt;wsdlOptions&gt;
            &lt;wsdlOption&gt;
              &lt;wsdl&gt;${basedir}/src/main/resources/wsdl/SomeService.wsdl&lt;/wsdl&gt;
              &lt;dependencies&gt;
                &lt;!-- Here I try to reference the XSD --&gt;
                &lt;dependency&gt;${basedir}/src/main/resources/wsdl/SomeTypes.xsd&lt;/dependency&gt;
              &lt;/dependencies&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;  
  </code></pre>
  
  <p>Any suggestions of why I'm getting an error? I'm not sure adding a <code>&lt;dependency&gt;</code> is the correct way, but I struggled to find documentation that describes how to reference XSD files.</p>
  
  <p>Here is the snippet from the WSDL file that refers to the missing type:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
        xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
        xmlns:bar="http://www.foo.com/bar" 
        targetNamespace="http://www.foo.com/bar"&gt;
    &lt;wsdl:message name="PushCommandSoapIn"&gt;
      &lt;wsdl:part name="parameters" element="bar:CommandMessage" /&gt;
    &lt;/wsdl:message&gt;
  </code></pre>
  
  <p>Here is the header and a snippet from the XSD file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;schema targetNamespace="http://www.foo.com/bar" 
        xmlns:bar="http://www.foo.com/bar" 
        xmlns="http://www.w3.org/2001/XMLSchema" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
        elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
    &lt;import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd" /&gt;
    ...
    &lt;element name="CommandMessage" type="bar:CommandMessageType" substitutionGroup="bar:Message" final="#all" /&gt;
  </code></pre>