Tuesday, August 7, 2012

How to customize MANIFEST files in WAR using Maven?


A war file contains MANIFEST files which is created by Maven. This post explains how to customize a manifest files to add our own values, which may get reflected while deploying on application servers like websphere.

The post How to create java war (web archive) file using Maven?  explains in detail about building war file for sample application using Maven. Refer it for creating your own simple webapp. This post is the continuation to it.

When you explode the war file created for the sample application code described in my previous post, it contains the below directory structure.
   simple-1.1-SNAPSHOT
       images/springsource.png
       jsp/hello.jsp
       META-INF
           maven/com.rsa.siddesh.simple/simple
              pom.properties
              pom.xml
           MANIFEST.MF
     WEB-INF
          web.xml
          classes
            examples/Hello.class
            images/springsource.png
          lib/servlet-api-2.5.jar
       index.html

The default MANIFEST.MF created by Maven looks like this

MANIFEST.MF
   Manifest-Version: 1.0
   Archiver-Version: Plexus Archiver
   Created-By: Apache Maven
   Built-By: guruss1
   Build-Jdk: 1.6.0_16

We can add many values to it through Maven.
1) 

No comments: