]> source.dussan.org Git - pf4j.git/commitdiff
add version in DefaultPluginManager
authorDecebal Suiu <decebal.suiu@gmail.com>
Wed, 23 Apr 2014 15:17:41 +0000 (18:17 +0300)
committerDecebal Suiu <decebal.suiu@gmail.com>
Wed, 23 Apr 2014 15:17:41 +0000 (18:17 +0300)
pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java
pom.xml

index 62a7a6d7a4909ed51f29f43b0a5887aa3799db90..a90ad5691e6d8239c4b6c7fd2937991a5a978d98 100644 (file)
@@ -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 ba3f609bc5ae190fec5879f1e84fc43a28520a20..8fee9d8bbe96f70490345a42f716cd9b783cd6e0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
             <plugin>
                 <artifactId>maven-jar-plugin</artifactId>
                 <version>2.4</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+                        </manifest>
+                    </archive>
+                </configuration>
             </plugin>
         </plugins>
     </build>