I need to have Maven insert the version number from the POM file into the manifest located in the WAR file under /WEB-INF/manifest.mf.
How do I do this? I was able to easily file documentation for doing this in a JAR file using the maven-jar-plugin, but that does not work on a WAR file.
Thanks for the help!
manifest.mf carries attributes of the artifact. One of the most well known ones is for example the main class of the jar that is used to start the jar file when no other class is specified. Syntax: Main-Class: classname. Other purposes are, for example, package sealing and package versioning.
Figured it out using the maven-war-plugin. See the configuration below:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <archive> <manifestEntries> <version>${project.version}</version> </manifestEntries> </archive> </configuration> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With