title: How to set up manifest class-path properly in maven-war-plugin
body: <p>I've used the maven-ear-plugin with the maven-war-plugin and maven-ejb-plugin to successfully deploy and run an application packaged as EAR to Jboss AS7.</p>
  
  <pre><code>.
  |-- META-INF
  |   |-- application.xml
  |   |-- MANIFEST.MF
  |   `-- maven
  |       `-- com.patrac
  |           `-- Patrac-ear
  |               |-- pom.properties
  |               `-- pom.xml
  |-- Patrac-ejb-1.0-SNAPSHOT.jar
  `-- Patrac-web-1.0-SNAPSHOT.war
  </code></pre>
  
  <p>In the application source code directories, the poms are located as follows:</p>
  
  <pre><code>.
  |
  |-- Patrac-ear
  |   `-- pom.xml
  |-- Patrac-ejb
  |  `-- pom.xml
  |-- Patrac-web
  |   `-- pom.xml
  `-- pom.xml
  </code></pre>
  
  <p>I can't figure out how to stop a few annoying warning messages when I deploy the application:</p>
  
  <pre><code>12:32:03,958 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry richfaces-components-ui-4.0.0.Final.jar in "/content/Patrac.ear/Patrac-web-1.0-SNAPSHOT.war"  does not point to a valid jar for a Class-Path reference.
  12:32:03,970 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry richfaces-components-api-4.0.0.Final.jar in "/content/Patrac.ear/Patrac-web-1.0-SNAPSHOT.war"  does not point to a valid jar for a Class-Path reference.
  12:32:03,984 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry richfaces-core-api-4.0.0.Final.jar in "/content/Patrac.ear/Patrac-web-1.0-SNAPSHOT.war"  does not point to a valid jar for a Class-Path reference.
  12:32:03,989 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry richfaces-core-impl-4.0.0.Final.jar in "/content/Patrac.ear/Patrac-web-1.0-SNAPSHOT.war"  does not point to a valid jar for a Class-Path reference.
  </code></pre>
  
  <p>Patrac-web-1.0-SNAPSHOT.war!META-INF/MANIFEST.MF looks like this:</p>
  
  <pre><code>Manifest-Version: 1.0
  Built-By: pgarner
  Build-Jdk: 1.7.0_02
  Class-Path: Patrac-ejb-1.0-SNAPSHOT.jar richfaces-components-ui-4.0.0.
   Final.jar richfaces-components-api-4.0.0.Final.jar richfaces-core-api
   -4.0.0.Final.jar richfaces-core-impl-4.0.0.Final.jar cssparser-0.9.5.
   jar sac-1.3.jar guava-r08.jar
  Created-By: Apache Maven
  Archiver-Version: Plexus Archiver
  </code></pre>
  
  <p>The ejb class-path entry needs to be present for the EJB module, for portability, and the richfaces, cssparser and guava class-path entries should NOT be in the WAR's manifest.</p>
  
  <p>The problem is that my WAR depends on all of the JARs, some of which live in <code>WEB-INF/lib</code> (RichFaces), and one JAR, <code>Patrac-ejb-1.0-SNAPSHOT.jar</code>, that lives in the root directory of the EAR.  Each dependency needs to be entered in Patrac-web/pom.xml but NOT each of the dependencies should appear in the manifest.  </p>
  
  <p>Maven puts the JARs in the correct places, but it puts  Class-Path entries for ALL of the JARs into the manifest.  It should not do this.  It should ONLY put an entry in for <code>Patrac-ejb-1.0-SNAPSHOT.jar</code>.</p>
  
  <pre><code>  &lt;!--
      According to Java EE 6 spec, the application is portable if
      Patrac-web.war's META-INF/MANIFEST.MF contains a Class-Path entry
      for Patrac-ejb-1.0-SNAPSHOT.jar.
  
      &lt;optional&gt;true&lt;/optional&gt; is the flag that maven-war-plugin uses
      to put the entry in MANIFEST.MF without copying Patrac-ejb-1.0-SNAPSHOT.jar
      into WEB-INF/lib.  This is what I want.
  
      &lt;scope&gt;provided&lt;/scope&gt; would cause maven-war-plugin to NEITHER
      put the entry in MANIFEST.MF nor copy Patrac-ejb.jar into WEB-INF/lib,
      which would not be good.
  
      No tag at all would cause maven-war-plugin to BOTH put the entry in
      MANIFEST.MF and copy Patrac-ejb.jar into WEB-INF/lib, which would
      also not be good.
    --&gt;
    &lt;dependency&gt;
       &lt;groupId&gt;com.patrac&lt;/groupId&gt;
       &lt;artifactId&gt;Patrac-ejb&lt;/artifactId&gt;
       &lt;type&gt;ejb&lt;/type&gt;
       &lt;optional&gt;true&lt;/optional&gt;
    &lt;/dependency&gt;
  
    &lt;!--
     These two dependencies are used to copy
    the other JAR files into WEB-INF/lib and there
    should not be any class-path entries for such
    JARs in MANIFEST.MF, in order to avoid the
    error messages.
    --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.richfaces.ui&lt;/groupId&gt;
          &lt;artifactId&gt;richfaces-components-ui&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.richfaces.core&lt;/groupId&gt;
          &lt;artifactId&gt;richfaces-core-impl&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I'm using the most recent maven-war-plugin version, 2.2.  How do I tell the maven-war-plugin to put the "non-ejb" JARs into WEB-INF/lib while not putting class-path entries in MANIFEST.MF? </p>
  
  <p>Any advice or pointers you have are greatly appreciated.</p>
  
  <p>References:</p>
  
  <ul>
  <li><a href="http://maven.apache.org/plugins/maven-war-plugin/">Maven War Plugin</a></li>
  <li><a href="http://maven.apache.org/plugins/maven-ear-plugin/">Maven Ear Plugin</a></li>
  </ul>