1 package com.atlassian.maven.plugins.amps.util;
2
3 import org.apache.commons.io.IOUtils;
4
5 import java.io.InputStream;
6 import java.io.IOException;
7 import java.util.Properties;
8
9 public class VersionUtils
10 {
11 public static String getVersion()
12 {
13 InputStream in = null;
14 final Properties props = new Properties();
15 try
16 {
17 in = VersionUtils.class.getClassLoader()
18 .getResourceAsStream(
19 "META-INF/maven/com.atlassian.maven.plugins/maven-amps-plugin/pom.properties");
20 if (in != null)
21 {
22 props.load(in);
23 return props.getProperty("version");
24 }
25 }
26 catch (final IOException e)
27 {
28 e.printStackTrace();
29 }
30 finally
31 {
32 IOUtils.closeQuietly(in);
33 }
34 return "RELEASE";
35 }
36 }