3.3. Generate MANIFEST.MF entries using Maven
Maven projects that use the Maven JAR, EJB or WAR packaging plug-ins can generate a
MANIFEST.MF
file with a Dependencies
entry. This does not automatically generate the list of dependencies, this process only creates the MANIFEST.MF
file with the details specified in the pom.xml
.
Prerequisites
- You must already have a working Maven project.
- The Maven project must be using one of the JAR, EJB, or WAR plug-ins (
maven-jar-plugin
,maven-ejb-plugin
,maven-war-plugin
). - You must know the name of the project's module dependencies. Refer to Section 3.8.2, “Included Modules” for the list of static modules included with JBoss EAP 6. If the module is another deployment , then refer to Section 3.1.7, “Dynamic Module Naming” to determine the module name.
Procedure 3.3. Generate a MANIFEST.MF file containing module dependencies
Add Configuration
Add the following configuration to the packaging plug-in configuration in the project'spom.xml
file.<configuration> <archive> <manifestEntries> <Dependencies></Dependencies> </manifestEntries> </archive> </configuration>
List Dependencies
Add the list of the module dependencies in the <Dependencies> element. Use the same format that is used when adding the dependencies to theMANIFEST.MF
. Refer to Section 3.2, “Add an Explicit Module Dependency to a Deployment” for details about that format.<Dependencies>org.javassist, org.apache.velocity</Dependencies>
Build the Project
Build the project using the Maven assembly goal.[Localhost ]$ mvn assembly:assembly
When the project is built using the assembly goal, the final archive contains a
MANIFEST.MF
file with the specified module dependencies.
Example 3.4. Configured Module Dependencies in pom.xml
The example here shows the WAR plug-in but it also works with the JAR and EJB plug-ins (maven-jar-plugin and maven-ejb-plugin).
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <manifestEntries> <Dependencies>org.javassist, org.apache.velocity</Dependencies> </manifestEntries> </archive> </configuration> </plugin> </plugins>