title: how to make cxf-xjc-plugin generate sources in utf-8
body: <p>I try to generate java classes from xsd in a maven project using cxf-xjc-plugin.</p>
  
  <p>It runs fine, but the generated source files get platform specific encoding (cp1251 on a windows pc) instead of utf-8. If any xsd types contain non-latin characters in schema annotations, then they become readable only in that specific encoding and the compiler later complains with <code>[WARNING] /C:/.../SomeType.java:[17,4] unmappable character for encoding UTF-8</code>.</p>
  
  <p><em>Please help me force <strong>utf-8</strong> for sources generation.</em></p>
  
  <p>The source encoding is set with</p>
  
  <pre><code>&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  </code></pre>
  
  <p>The build plugin is set up like that:</p>
  
  <pre><code>&lt;build&gt;
      ...
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-xjc-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.7.0&lt;/version&gt;
          &lt;configuration&gt;
              &lt;extensions&gt;
                  &lt;extension&gt;org.apache.cxf.xjcplugins:cxf-xjc-dv:2.7.0&lt;/extension&gt;
                  &lt;extension&gt;net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8&lt;/extension&gt;
              &lt;/extensions&gt;
          &lt;/configuration&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;id&gt;generate-sources&lt;/id&gt;
                  &lt;phase&gt;generate-sources&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;xsdtojava&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;sourceRoot&gt;${basedir}/target/generated-sources&lt;/sourceRoot&gt;
                      &lt;xsdOptions&gt;
                          &lt;xsdOption&gt;
                              &lt;extension&gt;true&lt;/extension&gt;
                              &lt;xsd&gt;${basedir}/src/main/resources/schemas/Policy.xsd&lt;/xsd&gt;
                              &lt;bindingFile&gt;${basedir}/src/main/resources/schemas/Policy.xjb&lt;/bindingFile&gt;
                              &lt;extensionArgs&gt;
                                  &lt;extensionArg&gt;-Xdv&lt;/extensionArg&gt;
                                  &lt;extensionArg&gt;-Xfluent-api&lt;/extensionArg&gt;
                              &lt;/extensionArgs&gt;
                          &lt;/xsdOption&gt;
                      &lt;/xsdOptions&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
  ...
  </code></pre>
  
  <p>after having read through some older issues with xjc, particularly <a href="https://issues.apache.org/jira/browse/CXF-4369" rel="noreferrer">CXF-4369</a> and <a href="https://java.net/jira/browse/JAXB-499" rel="noreferrer">JAXB-499</a> I tried to force encoding with maven project property <code>&lt;file.encoding&gt;utf-8&lt;/file.encoding&gt;</code> and set a system property while running <code>mvn -Dfile.encoding=utf-8 clean install</code>, but got nowhere.</p>