How to add Archive Version to MANIFEST.MF file with Maven

I was asssigned a task in which I needed to see the version of the war file deployed in the weblogic admin console, it was not being displayed and they wanted to see it, so I had no clue about it, after some research I found that in the MANIFEST.MF file of the WAR file there should have this entry:

Weblogic-Application-Version: mySimulator-1.2.3.4_ABC

So its ok, I added it and deployed it in weblogic and it works, now the task is to automate it so that when I do mvn clean install it add that entry to the MANIFEST.MF file.

This is done in the pom.xml file of the project (yes, by the way, I am using maven). You just add the following:

maven-war-plugin                     

    ${project.artifactId}-${project.version}
                
src

WebContent/WEB-INF
WEB-INF

weblogic.xml

And that’s it, run mvn clean install and it should generate it with that entry automatically so that you can just deploy and see the archive version in the deployments tab in weblogic admin console.

Sources: