01: package liquibase.util;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05: import java.net.URL;
06: import java.util.Properties;
07:
08: public class LiquibaseUtil {
09: public static String getBuildVersion() {
10: Properties buildInfo = new Properties();
11: URL buildInfoFile = Thread.currentThread()
12: .getContextClassLoader().getResource(
13: "buildinfo.properties");
14: try {
15: if (buildInfoFile == null) {
16: return "UNKNOWN";
17: } else {
18: InputStream in = buildInfoFile.openStream();
19:
20: buildInfo.load(in);
21: String o = (String) buildInfo.get("build.version");
22: if (o == null) {
23: return "UNKNOWN";
24: } else {
25: return o;
26: }
27: }
28: } catch (IOException e) {
29: return "UNKNOWN";
30: }
31: }
32: }
|