diff options
-rw-r--r-- | pdf-over-commons/pom.xml | 9 | ||||
-rw-r--r-- | pdf-over-commons/src/main/java/at/asit/pdfover/commons/Constants.java | 18 | ||||
-rw-r--r-- | pdf-over-commons/src/main/resources/version.properties | 1 |
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} |