Include xml files in maven project
<p>I have a maven pom file to build from a structure like:</p>

<p>package1<br>
--1.java<br>
--2.java<br>
--packageMetaInfo.xml</p>

<p>package2<br>
--21.java<br>
--22.java<br>
--packageMetaInfo.xml</p>

<p>When I do a maven compile, the xml files don't come in the target.<br>
maven-compiler-plugin 3.5.1 - Unless I exclude the xmls through <code>&lt;exclusions&gt;</code>, I get an error that "Fatal error compiling: All compilation units must be of SOURCE kind ->"
maven-compiler-plugin 2.0.1 - compiles but skips the xmls</p>

<p>Is there a way I can have the xmls included in my jar. The structure would be</p>

<p>x.jar<br>
&nbsp;&nbsp;package1<br>
&nbsp;&nbsp;--1.class<br>
&nbsp;&nbsp;--2.class<br>
&nbsp;&nbsp;--packageMetaInfo.xml  </p>

<p>&nbsp;&nbsp;package2<br>
&nbsp;&nbsp;--21.class<br>
&nbsp;&nbsp;--22.class<br>
&nbsp;&nbsp;--packageMetaInfo.xml</p>

<p>*I understand it may not be maven standard to have xml with source files but I am working on a specific product and need to maintain this structure in both input and output.</p>

<pre class="lang-xml prettyprint-override"><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/maven-v4_0_0.xsd"&gt;

  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.incent&lt;/groupId&gt;
  &lt;artifactId&gt;Release-4.3.0.1.0.0001&lt;/artifactId&gt;
  &lt;name&gt;AAA Custom code&lt;/name&gt;
  &lt;version&gt;2.4.0.1&lt;/version&gt;  

  &lt;properties&gt;
        &lt;ormb.cmccb.path&gt;./Active_Repository/CMCCB&lt;/ormb.cmccb.path&gt;
        &lt;ormb.customcode.path&gt;${ormb.cmccb.path}/data&lt;/ormb.customcode.path&gt;
        &lt;ormb.release.name&gt;AAA-4.3.0.1.0.0001&lt;/ormb.release.name&gt;
        &lt;ormb.target.path&gt;./target&lt;/ormb.target.path&gt;
        &lt;ormb.output.path&gt;Release-${ormb.release.name}/Application/${ormb.release.name}/CMCCB&lt;/ormb.output.path&gt;
        &lt;ormb.serverfile.output.relpath&gt;./target/server&lt;/ormb.serverfile.output.relpath&gt;    
    &lt;build.number&gt;SNAPSHOT&lt;/build.number&gt;
  &lt;/properties&gt;



 &lt;dependencies&gt;

    &lt;dependency&gt;
    &lt;groupId&gt;org.ow2.asm&lt;/groupId&gt;
    &lt;artifactId&gt;asm&lt;/artifactId&gt;
    &lt;version&gt;5.0.3&lt;/version&gt;
&lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;antlr&lt;/groupId&gt;
        &lt;artifactId&gt;antlr&lt;/artifactId&gt;
        &lt;version&gt;2.7.7&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;icu4j&lt;/groupId&gt;
        &lt;artifactId&gt;icu4j&lt;/artifactId&gt;
        &lt;version&gt;49.1&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;dom4j&lt;/groupId&gt;
        &lt;artifactId&gt;dom4j&lt;/artifactId&gt;
        &lt;version&gt;1.6.1&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;commons-lang&lt;/groupId&gt;
        &lt;artifactId&gt;commons-lang&lt;/artifactId&gt;
        &lt;version&gt;2.2&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;wlfullclient&lt;/groupId&gt;
        &lt;artifactId&gt;wlfullclient&lt;/artifactId&gt;
        &lt;version&gt;10.3.4.0&lt;/version&gt;
        &lt;type&gt;jar&lt;/type&gt;
    &lt;/dependency&gt;
    &lt;/dependencies&gt;


  &lt;build&gt;

    &lt;sourceDirectory&gt;${ormb.customcode.path}/java&lt;/sourceDirectory&gt;  

    &lt;plugins&gt;
    &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.6&lt;/version&gt;
        &lt;configuration&gt;
            &lt;encoding&gt;UTF-8&lt;/encoding&gt;
        &lt;/configuration&gt;
        &lt;executions&gt;
           &lt;execution&gt;
            &lt;id&gt;copy-cm&lt;/id&gt;
            &lt;phase&gt;install&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;copy-resources&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;outputDirectory&gt;${ormb.customcode.path}/etc/lib&lt;/outputDirectory&gt;
                &lt;overwrite&gt;true&lt;/overwrite&gt;
                &lt;resources&gt;
                    &lt;resource&gt;
                        &lt;directory&gt;${ormb.target.path}&lt;/directory&gt;
                        &lt;includes&gt;
                            &lt;include&gt;cm.jar&lt;/include&gt;
                        &lt;/includes&gt;
                    &lt;/resource&gt;
                &lt;/resources&gt;
            &lt;/configuration&gt;
            &lt;/execution&gt;
            &lt;execution&gt;
                &lt;id&gt;copy-mwpackage&lt;/id&gt;
                &lt;phase&gt;install&lt;/phase&gt;
                &lt;goals&gt;
                    &lt;goal&gt;copy-resources&lt;/goal&gt;
                &lt;/goals&gt;
                &lt;configuration&gt;
                    &lt;outputDirectory&gt;${ormb.serverfile.output.relpath}&lt;/outputDirectory&gt;
                &lt;overwrite&gt;true&lt;/overwrite&gt;
                &lt;resources&gt;
                    &lt;resource&gt;
                        &lt;directory&gt;${ormb.target.path}&lt;/directory&gt;
                        &lt;includes&gt;
                            &lt;include&gt;Release-${ormb.release.name}.zip&lt;/include&gt;
                        &lt;/includes&gt;
                    &lt;/resource&gt;
                &lt;/resources&gt;
            &lt;/configuration&gt;
            &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.5.1&lt;/version&gt;
        &lt;configuration&gt;
            &lt;encoding&gt;ISO-8859-1&lt;/encoding&gt; 
            &lt;source&gt;1.7&lt;/source&gt;
            &lt;target&gt;1.7&lt;/target&gt;
          &lt;includes&gt;
            &lt;include&gt;**/cm/**&lt;/include&gt; 
          &lt;/includes&gt;
          &lt;excludes&gt;
            &lt;exclude&gt;**/*.xml&lt;/exclude&gt;
          &lt;/excludes&gt;
        &lt;resources&gt;
            &lt;resource&gt;
            &lt;directory&gt;${ormb.customcode.path}/java&lt;/directory&gt;
            &lt;includes&gt;
                &lt;include&gt;**/*.xml&lt;/include&gt;
            &lt;/includes&gt;
            &lt;/resource&gt;
        &lt;/resources&gt;


        &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.6&lt;/version&gt;
         &lt;executions&gt;
         &lt;execution&gt;
            &lt;id&gt;create-cm&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;single&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                &lt;descriptors&gt;
                    &lt;descriptor&gt;Active_Repository/assembly/executable.xml&lt;/descriptor&gt;
                &lt;/descriptors&gt;
                &lt;finalName&gt;cm&lt;/finalName&gt;
                 &lt;manifest&gt;
                    &lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
                &lt;/manifest&gt;
                &lt;archive&gt;
                    &lt;manifestEntries&gt;
                        &lt;Specification-Title&gt;${project.name}&lt;/Specification-Title&gt;
                        &lt;Specification-Version&gt;${project.version}&lt;/Specification-Version&gt;
                        &lt;Implementation-Version&gt;${build.number}&lt;/Implementation-Version&gt;
                    &lt;/manifestEntries&gt;
                &lt;/archive&gt;
            &lt;/configuration&gt;
            &lt;/execution&gt;
            &lt;execution&gt;
            &lt;id&gt;create-distro&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;single&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;descriptors&gt;
                &lt;descriptor&gt;Active_Repository/assembly/dist.xml&lt;/descriptor&gt;
              &lt;/descriptors&gt;
              &lt;finalName&gt;custom-action-dist&lt;/finalName&gt;
              &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
              &lt;finalName&gt;Release-${ormb.release.name}&lt;/finalName&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;

&lt;/project&gt;
</code></pre>