Return to Snippet

Revision: 21804
at December 21, 2009 18:26 by ff1959


Initial Code
String appServerHome = getServletContext().getRealPath("/");

File manifestFile = new File(appServerHome, "META-INF/MANIFEST.MF");
 
Manifest mf = new Manifest();
mf.read(new FileInputStream(manifestFile));

Attributes atts = mf.getMainAttributes();

System.out.println("Version: " + atts.getValue("Implementation-Version"));
System.out.println("Build: " + atts.getValue("Implementation-Build"));

Initial URL


Initial Description
How to access the build number in the WAR file (generated by the Maven build number plugin) from Java.

Initial Title
Access build number from MANIFEST

Initial Tags
java

Initial Language
Java