How to add entries in MANIFEST.MF of WAR EAR and JAR in Maven


We may come across a situation where we need to add more entries to MANIFEST.MF in jar or war files other than the default entries. In Maven we have plug ins to accomplish the same.

In war files, we can use maven-war-plugin as below. Build number and the computer name will be added along with the default entries.
       <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <manifest>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          </manifest>
          <archive>
            <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
              <Build-Machine>${env.COMPUTERNAME}</Build-Machine>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

</plugins>
   </build>


In EJB jar files we can use maven-ejb-plugin. For normal jars please use maven-jar-plugin in a similar fashion

 <plugin>
            <artifactId>maven-ejb-plugin</artifactId>
            <configuration>
               <archive>
                  <manifest>
                     <addClasspath>true</addClasspath>
                  </manifest>
                   <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
              <Build-Machine>${env.COMPUTERNAME}</Build-Machine>
            </manifestEntries>
               </archive>
            </configuration>
         </plugin>

 
 
 
 
Comments:

Post a Comment:
  • HTML Syntax: Allowed
 

« January 2009
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today

Valid XHTML or CSS?

[This is a Roller site]
 
© Karthik