summaryrefslogtreecommitdiff
path: root/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-18 12:27:14 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-18 12:27:14 +0100
commit86f1fe8b6621110741df4fddf5fe866ba844e8c7 (patch)
treeba0baf58f24eefb09e5882f1464e2ed49c5c7f58 /pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
parent19253585bcd31ebceba9c5ae85068f5dcb15fb91 (diff)
downloadpdf-over-86f1fe8b6621110741df4fddf5fe866ba844e8c7.tar.gz
pdf-over-86f1fe8b6621110741df4fddf5fe866ba844e8c7.tar.bz2
pdf-over-86f1fe8b6621110741df4fddf5fe866ba844e8c7.zip
move to a more stable version detection mechanism, powered by maven; cf. #63 #65
Diffstat (limited to 'pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java')
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
index 901d0824..4b6e3c10 100644
--- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
+++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java
@@ -23,6 +23,8 @@ import java.util.Properties;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -30,11 +32,25 @@ import org.eclipse.swt.widgets.Display;
*/
public class Constants {
+ static private final Logger log = LoggerFactory.getLogger(Constants.class);
+
/** Application name */
public static final String APP_NAME = "PDF-Over"; //$NON-NLS-1$
/** Application version */
- public static final String APP_VERSION = Constants.class.getPackage().getImplementationVersion();
+ public static final String APP_VERSION;
+ static
+ {
+ String v = null;
+ try {
+ Properties props = new Properties();
+ props.load(Constants.class.getClassLoader().getResourceAsStream("version.properties"));
+ v = props.getProperty("version");
+ } catch (Exception e) {
+ log.warn("Failed to load project version", e);
+ }
+ APP_VERSION = v;
+ }
/** Application name + version */
public static final String APP_NAME_VERSION = (APP_VERSION == null ? APP_NAME : APP_NAME + " v" + APP_VERSION); //$NON-NLS-1$