Friday, August 16, 2013

JSP in a WAR showing maven version

I have googled the planet for a simple solution to displaying the build version of the war project in a JSP.

If you use a war plugin, then you might try filtering.

Personally I HATE maven so, after a few failed attempts, I have simply done this and it works magically:

in my jsp I simply read a file in META_INF folder:

Properties mavenproperties = new Properties();
obelixversion=" + mavenproperties.getProperty("version") + "

being wlobelix my artifactIdand and com.acme.common my groupId contains:


#Generated by Maven
#Fri Aug 16 15:38:28 CEST 2013

No comments: