You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Davis Ford <da...@zenoconsulting.biz> on 2009/03/11 21:56:55 UTC

maven-war-plugin: War Manifest Customization

Hi, the war plugin explains how to customize the manifest here:

http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html

I can't seem to repeat this.  I'm wondering what I'm doing wrong.
Here's a quick example with two projects: one jar project (foo-bar),
and one webapp project.  The foo-bar project depends on commons-cli,
and the webapp project depends on foo-bar.  If I configure the pom.xml
as follows, and run 'mvn package' on the webapp project, it includes
commons-cli in the WEB-INF/lib folder.  I don't want this. I want it
to include it in the META-INF/Manifest classpath, but not in
WEB-INF/lib -- any ideas?

Thanks in advance!

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

<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>

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

<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>

-- 
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven-war-plugin: War Manifest Customization

Posted by Dennis Lundberg <de...@apache.org>.
Hi

You just need to use a newer version of Maven WAR Plugin. The classpath
manifest functionality was not available in version 2.0.

2.1-alpha-2 is the latest version.

Davis Ford wrote:
> Hi, the war plugin explains how to customize the manifest here:
> 
> http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html
> 
> I can't seem to repeat this.  I'm wondering what I'm doing wrong.
> Here's a quick example with two projects: one jar project (foo-bar),
> and one webapp project.  The foo-bar project depends on commons-cli,
> and the webapp project depends on foo-bar.  If I configure the pom.xml
> as follows, and run 'mvn package' on the webapp project, it includes
> commons-cli in the WEB-INF/lib folder.  I don't want this. I want it
> to include it in the META-INF/Manifest classpath, but not in
> WEB-INF/lib -- any ideas?
> 
> Thanks in advance!
> 
> $ mvn archetype:create -DgroupId=com.example -DartifactId=foo-bar
> 
> <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>
> 
> $ mvn archetype:create -DgroupId=com.example -DartifactId=webapp
> -DarchetypeArtifactId=maven-archetype-webapp
> 
> <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>
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org