Hi Wayne, here's a more concrete example.  I'm sure I'm just doing
something stupid, but I hope this makes it easier to see the
stupid-ness.

Create a new jar project:

mvn archetype:create -DgroupId=com.example -DartifactId=foo-bar

Make the pom.xml look like this:

<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";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>foo-bar</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>foo-bar</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
</project>

Create a new war project:

mvn archetype:create -DgroupId=com.example -DartifactId=webapp
-DarchetypeArtifactId=maven-archetype-webapp

Make the pom.xml look like this:

<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";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>webapp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>webapp Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>com.example</groupId>
          <artifactId>foo-bar</artifactId>
          <version>1.0-SNAPSHOT</version>
          <optional>true</optional>
    </dependency>
  </dependencies>
  <build>
    <finalName>webapp</finalName>
        <plugins>
          <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.0</version>
       <configuration>
         <archive>
           <manifest>
             <addClasspath>true</addClasspath>
           </manifest>
         </archive>
       </configuration>
     </plugin>
        </plugins>
  </build>
</project>

Do mvn install on the foo-bar project.
Do mvn package on the webapp project.  See that all the commons-cli
dependencies are included inside the war WEB-INF/lib directory?  How
to only add this to the manifest classpath and not include in
WEB-INF/lib ?

Regards,
Davis

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to