
com.afrigis.services.util.Version Maven / Gradle / Ivy
package com.afrigis.services.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.commons.io.IOUtils;
/**
*
* Carefully and safely extracts the library version if available.
*
*
* @author hendrikc
*
*/
public final class Version {
private Version() {
}
/**
*
* Extracts and returns the semantic version of this lib.
*
*
* @return the version of this library
*/
public static String getVersion() {
final String path = "/version.prop";
InputStream stream = null;
final Properties props = new Properties();
try {
stream = Version.class.getResourceAsStream(path);
props.load(stream);
return (String) props.get("version");
} catch (IOException e) {
return "UNKNOWN";
} finally {
IOUtils.closeQuietly(stream);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy