1 /* 2 * Jour - bytecode instrumentation library 3 * 4 * Copyright (C) 2007 Vlad Skarzhevskyy 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public 17 * License along with this library; if not, write to the 18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 * Boston, MA 02111-1307, USA. 20 * 21 * @version $Id: BuildVersion.java 67 2007-10-17 08:55:14Z vlads $ 22 * 23 */ 24 package net.sf.jour.util; 25 26 import java.io.IOException; 27 import java.io.InputStream; 28 import java.util.Properties; 29 30 /** 31 * @author vlads 32 * 33 */ 34 public class BuildVersion { 35 36 public static String getVersion() { 37 InputStream is = BuildVersion.class 38 .getResourceAsStream("/META-INF/maven/net.sf.jour/jour-instrument/pom.properties"); 39 if (is != null) { 40 Properties projectProperties = new Properties(); 41 try { 42 projectProperties.load(is); 43 String version = projectProperties.getProperty("version"); 44 if (version != null) { 45 return version; 46 } 47 } catch (IOException ignore) { 48 } 49 } 50 return "n/a"; 51 } 52 }