diff options
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java | 14 | ||||
-rw-r--r-- | pom.xml | 8 |
2 files changed, 22 insertions, 0 deletions
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 @@ -93,6 +93,14 @@ <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> |