Use Your Own Manifest File

By default, Maven Archiver creates the manifest file for you. It is sometimes useful to use your own hand crafted manifest file. Say that you want to use the manifest file src/main/resources/META-INF/MANIFEST.MF. This is done with the <manifestFile> configuration element by setting the value to the location of your file.

The content of your own manifest file will be merged with the entries created by Maven Archiver. If you specify an entry in your own manifest file it will override the value created by Maven Archiver.

Note: As with all the examples here, this configuration can be used in all plugins that use Maven Archiver, not just maven-jar-plugin as in this example.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        ...
        <configuration>
          <archive>
            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
        ...
      </plugin>
    </plugins>
  </build>
  ...
</project>