title: How to add a directory to a JAR file with Maven?
body: <p>I'm trying to package a web application as a runnable JAR file with Maven. The <em>jar-with-dependencies</em> assembly takes care of including all the dependencies, but I still need to include <em>src/main/webapp</em>.</p>
  
  <p>I managed to add the directory to my JAR with a custom assembly:</p>
  
  <pre><code>&lt;assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
                                http://maven.apache.org/xsd/assembly-1.1.2.xsd"&gt;
      &lt;id&gt;webapp&lt;/id&gt;
      &lt;formats&gt;
          &lt;format&gt;jar&lt;/format&gt;
      &lt;/formats&gt;
      &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt;
      &lt;fileSets&gt;
          &lt;fileSet&gt;
              &lt;directory&gt;src/main/webapp&lt;/directory&gt;
              &lt;outputDirectory&gt;/webapp&lt;/outputDirectory&gt;
          &lt;/fileSet&gt;
      &lt;/fileSets&gt; 
  &lt;/assembly&gt;
  </code></pre>
  
  <p>And it does work, and it's even possible to use this assembly together with <em>jar-with-dependencies</em>. However, the final JAR contains the webapp directory and all dependencies, but not the class files of my project. My assembly is apparently removing them.</p>
  
  <p>Can I preserve the class files of my own project in an assembly? Or is there another way to add a directory to a JAR?</p>