MavenUtil { public static String getCurrentVersion() { Model model = null; try { MavenXpp3Reader reader = new MavenXpp3Reader(); if ((new File("pom.xml")).exists()) { model = reader.read(new FileReader("pom.xml")); } else { model = reader.read(new InputStreamReader(MavenUtil.class.getResourceAsStream( "/META-INF/maven/com.stnetix.ariaddna/common-utils/pom.xml"))); } } catch (IOException e) { LOGGER.error("Can't read Pom.xml file. Exception message is: ", e.getMessage()); } catch (XmlPullParserException e) { LOGGER.error("Can't parse Pom.xml file. Exception message is: ", e.getMessage()); } return model != null ? model.getParent().getVersion() : "0.0.0"; } private  MavenUtil(); static String getCurrentVersion();  }
@Test public void getCurrentVersion() throws Exception { String version = MavenUtil.getCurrentVersion(); assertEquals(version, "1.0-SNAPSHOT"); }