From: Decebal Suiu Date: Wed, 23 Apr 2014 15:17:41 +0000 (+0300) Subject: add version in DefaultPluginManager X-Git-Tag: release-0.9.0~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=90aefdd1211a15c430bde06cbb45753f9fc03360;p=pf4j.git add version in DefaultPluginManager --- diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java index 62a7a6d..a90ad56 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java @@ -604,6 +604,20 @@ public class DefaultPluginManager implements PluginManager { pluginStateListeners.remove(listener); } + public Version getVersion() { + String version = null; + + Package pf4jPackage = getClass().getPackage(); + if (pf4jPackage != null) { + version = pf4jPackage.getImplementationVersion(); + if (version == null) { + version = pf4jPackage.getSpecificationVersion(); + } + } + + return (version != null) ? Version.createVersion(version) : Version.ZERO; + } + /** * Add the possibility to override the PluginDescriptorFinder. * By default if getRuntimeMode() returns RuntimeMode.DEVELOPMENT than a diff --git a/pom.xml b/pom.xml index ba3f609..8fee9d8 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,14 @@ maven-jar-plugin 2.4 + + + + true + true + + +