title: Maven - maven-war-plugin to generate jar and install it to maven local repository
body: <p>I am using maven-war-plugin in my <code>pom.xml</code> to generate a <code>jar</code> file in parallel with my <code>war</code> file in an <code>java web project</code> build. My <code>maven</code> build is creating <code>war</code> and <code>jar</code> files in the target directory. And only <code>war</code> file is installed to local repository. Is there a way to push the <code>jar</code> file created as well to local repository. Below is the snippet of my pom.xml</p>
  
  <pre><code>&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;archive&gt;
              &lt;addMavenDescriptor&gt;false&lt;/addMavenDescriptor&gt;
              &lt;/archive&gt;
              &lt;archiveClasses&gt;true&lt;/archiveClasses&gt;
          &lt;packagingExcludes&gt;WEB-INF/lib/x*.jar&lt;/packagingExcludes&gt;
          &lt;webXml&gt;${project.basedir}\src\main\webapp\WEB-INF\web.xml&lt;/webXml&gt;
           &lt;webResources&gt;
          &lt;resource&gt;
            &lt;directory&gt;${project.basedir}\src\main\webapp&lt;/directory&gt;
            &lt;includes&gt;
              &lt;include&gt;**/*.*&lt;/include&gt;
            &lt;/includes&gt;
          &lt;/resource&gt;
              &lt;/webResources&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>pom.xml content:</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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.xyz&lt;/groupId&gt;
      &lt;artifactId&gt;x&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;x&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;build&gt;
          &lt;plugins&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;archive&gt;
                          &lt;addMavenDescriptor&gt;false&lt;/addMavenDescriptor&gt;
                          &lt;/archive&gt;
                          &lt;archiveClasses&gt;true&lt;/archiveClasses&gt;
                      &lt;packagingExcludes&gt;WEB-INF/lib/x*.jar&lt;/packagingExcludes&gt;
                      &lt;webXml&gt;${project.basedir}\src\main\webapp\WEB-INF\web.xml&lt;/webXml&gt;
                       &lt;webResources&gt;
                      &lt;resource&gt;
                        &lt;directory&gt;${project.basedir}\src\main\webapp&lt;/directory&gt;
                        &lt;includes&gt;
                          &lt;include&gt;**/*.*&lt;/include&gt;
                        &lt;/includes&gt;
                      &lt;/resource&gt;
                          &lt;/webResources&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${java-version}&lt;/source&gt;
                      &lt;target&gt;${java-version}&lt;/target&gt;
                      &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                &lt;groupId&gt;com.googlecode.addjars-maven-plugin&lt;/groupId&gt;
                &lt;artifactId&gt;addjars-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.2&lt;/version&gt;
                &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;add-jars&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;resources&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;${project.basedir}/src/main/webapp/WEB-INF/lib&lt;/directory&gt;
                              &lt;/resource&gt;
                          &lt;/resources&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
                &lt;/executions&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>