title: Maven project build into jar and war
body: <p>I have a project with the following <em>pom.xml</em> and I have removed some of the unwanted stuff from it. What I intended to happen was to generate a jar file and ultimately generate a <code>war</code> package that includes the <code>jar</code> file as a library. Unfortunately, this doesn't seem to be happening with the following <code>pom.xml</code>.</p>
  
  <pre><code>&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;artifactId&gt;test&lt;/artifactId&gt;
      &lt;groupId&gt;com.test.abcd&lt;/groupId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;Test Application&lt;/name&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;${maven-compiler-plugin.version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;annotationProcessorPaths&gt;
                      &lt;path&gt;
                          &lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
                          &lt;artifactId&gt;mapstruct-processor&lt;/artifactId&gt;
                          &lt;version&gt;${mapstruct.version}&lt;/version&gt;
                      &lt;/path&gt;
                  &lt;/annotationProcessorPaths&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;warSourceDirectory&gt;target/www/&lt;/warSourceDirectory&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;build-war-in-classes&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;war&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Even though this generates both a <code>jar</code> and a <code>war</code> during the package phase, the <code>war</code> doesn't include <code>jar</code> file (<code>WEB-INF/lib/test-0.0.1-SNAPSHOT.jar</code>) as a library and in stead I see the following classes,</p>
  
  <pre><code>META-INF/
  META-INF/MANIFEST.MF
  ....
  WEB-INF/
  WEB-INF/classes/
  ....
  </code></pre>
  
  <p>What could be causing this behaviour ?</p>