summaryrefslogtreecommitdiff
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
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
-rw-r--r--pdf-over-commons/pom.xml9
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java18
-rw-r--r--pdf-over-commons/src/main/resources/version.properties1
3 files changed, 27 insertions, 1 deletions
diff --git a/pdf-over-commons/pom.xml b/pdf-over-commons/pom.xml
index d62f6257..d9c944ed 100644
--- a/pdf-over-commons/pom.xml
+++ b/pdf-over-commons/pom.xml
@@ -24,5 +24,14 @@
</dependency>
</dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+
</project> \ No newline at end of file
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$
diff --git a/pdf-over-commons/src/main/resources/version.properties b/pdf-over-commons/src/main/resources/version.properties
new file mode 100644
index 00000000..defbd482
--- /dev/null
+++ b/pdf-over-commons/src/main/resources/version.properties
@@ -0,0 +1 @@
+version=${project.version}