title: Why is the Maven JAR plugin not including some resources?
body: <p>I have an enterprise application which I am in the process of converting from an Ant build to Maven.  It's almost completely converted; this is the very last thing I need to fix.  The application is packaged as an EAR file which contains two WARs and has a JAR module which provides all of the core functionality of the application.</p>
  
  <p>I'm using the Freemarker templating library to generate, among other things, message bodies for automatic emails sent by the application.  Freemarker needs its *.ftl template files to be on the classpath, and since this is core application functionality not specific to one WAR or the other, it needs to be in the JAR.</p>
  
  <p>The Maven module which defines the JAR has the following POM:</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/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;relativePath&gt;../../pom.xml&lt;/relativePath&gt;
          &lt;groupId&gt;com.company.project&lt;/groupId&gt;
          &lt;artifactId&gt;projectName&lt;/artifactId&gt;
          &lt;version&gt;1.8.0&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;core&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;Core Application&lt;/name&gt;
  
      &lt;profiles&gt;
         &lt;!-- snip --&gt;
      &lt;/profiles&gt;
  
      &lt;dependencies&gt;
         &lt;!-- snip --&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
                  &lt;includes&gt;
                      &lt;include&gt;**/*.ftl&lt;/include&gt;
                      &lt;include&gt;**/*.properties&lt;/include&gt;
                      &lt;include&gt;**/*.xml&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
          &lt;plugins&gt;
              &lt;!-- snip --&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The *.ftl files are located at src/main/resources/template/, with some in a subdirectory within template/.  There are other files within src/main/resources -- some .properties and some .xml, some at the root and some under a directory structure.</p>
  
  <p>When I run the package phase on this module (or on the parent), the target/classes directory created as part of the build process contains the template directory, which in turn contains all of the *.ftl, *.xml, and *.properties files with an appropriate directory structure.  If I JAR this directory up manually, everything works perfectly.</p>
  
  <p>Here's where this gets weird and I get lost: when maven-jar-plugin creates the JAR, it includes the XML and properties files, but the template directory is completely absent from the JAR and its contents are nowhere to be found.</p>
  
  <p>As you can see above, I tried explicitly including **/*.ftl.  It doesn't make a difference; I can exclude the entire "includes" tag and I get the exact same behavior.</p>
  
  <p>I'm using Maven 3.0.5 and maven-jar-plugin 2.4.</p>