Last active
August 29, 2015 14:21
-
-
Save MaximeFrancoeur/1ed430e96c32b649e0b8 to your computer and use it in GitHub Desktop.
Version project Maven
http://stackoverflow.com/questions/1906266/maven-2-how-to-package-current-project-version-in-a-war-file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PomVersion { | |
final private static Logger LOGGER = LogManager.getLogger(PomVersion.class); | |
final static String VERSION = loadVersion(); | |
private static String loadVersion() { | |
Properties properties = new Properties(); | |
try { | |
InputStream inStream = PomVersion.class.getClassLoader().getResourceAsStream("version.properties"); | |
properties.load(inStream); | |
} catch (Exception e){ | |
LOGGER.warn("Unable to load version.properties using PomVersion.class.getClassLoader().getResourceAsStream(...)", e); | |
} | |
return properties.getProperty("pom.version"); | |
} | |
public static String getVersion(){ | |
return VERSION; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment