title: Maven pack directory with html files into jar
body: <p>I have a simple web app with following structure:</p>
  
  <p><a href="https://i.stack.imgur.com/8SPcb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8SPcb.png" alt="project structure"></a></p>
  
  <p>I need to pack it into a <code>jar</code>.
  Here's my pom.xml:</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;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;L1.1&lt;/groupId&gt;
      &lt;artifactId&gt;L1.1&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
      &lt;/properties&gt;
  
  
      &lt;build&gt;
          &lt;plugins&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.3&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
  
                  &lt;configuration&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                      &lt;outputDirectory&gt;${basedir}&lt;/outputDirectory&gt;
                      &lt;finalName&gt;server&lt;/finalName&gt;
                      &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;main.Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;templates&lt;/directory&gt;
                  &lt;includes&gt;
                      &lt;include&gt;page.html&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.freemarker&lt;/groupId&gt;
              &lt;artifactId&gt;freemarker&lt;/artifactId&gt;
              &lt;version&gt;2.3.20&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
              &lt;artifactId&gt;jetty-server&lt;/artifactId&gt;
              &lt;version&gt;9.3.0.M0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
              &lt;artifactId&gt;jetty-webapp&lt;/artifactId&gt;
              &lt;version&gt;9.3.0.M0&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I pack it with <code>Maven</code>'s <code>assembly:single</code> option:
  <a href="https://i.stack.imgur.com/ktltx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ktltx.png" alt="maven option"></a></p>
  
  <p>But when I run my app with <code>java -jar server.jar</code> and pass a request in browser I get:</p>
  
  <pre><code>java.io.FileNotFoundException: Template "templates/page.html" not found.
  </code></pre>
  
  <p>This happens because a folder <code>templates</code> with <code>page.html</code> in it is not added to <code>jar</code> - I unpacked <code>server.jar</code> searched for it, but didn't find.</p>
  
  <p>I googled a lot something like "maven pack resources into jar" or "maven pack html into jar". And the most close article to my issue was:
  <a href="https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html" rel="nofollow noreferrer">https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html</a></p>
  
  <p>I followed instructions in that article - added <code>&lt;resources&gt;</code> and rest tags where I outlined my folder and a file that I want to include in <code>jar</code> (please see it in <code>pom.xml</code> that I wrote above).</p>
  
  <p>But still this folder and <code>page.html</code> aren't added.</p>
  
  <p>Please guide me, what I'm doing wrong and how to add <code>templates</code> folder with <code>page.html</code> in it in <code>jar</code>.</p>