From: Decebal Suiu Date: Mon, 28 Mar 2016 17:26:31 +0000 (+0300) Subject: Improve readme X-Git-Tag: release-0.13.0~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=457869eb0f79e5907bc60fabbe69ca7d131a9d70;p=pf4j.git Improve readme --- diff --git a/README.md b/README.md index 5cc8b67..84f16d4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ Plugin Framework for Java (PF4J) ===================== [![Travis CI Build Status](https://travis-ci.org/decebals/pf4j.png)](https://travis-ci.org/decebals/pf4j) + [![Maven Central](http://img.shields.io/maven-central/v/ro.fortsoft.pf4j/pf4j.svg)](http://search.maven.org/#search|ga|1|pf4j) A plugin is a way for a third party to extend the functionality of an application. A plugin implements extension points @@ -186,7 +188,7 @@ protected PluginDescriptorFinder createPluginDescriptorFinder() { } ``` -and in plugin respository you must have a plugin.properties file with the below content: +and in plugin repository you must have a plugin.properties file with the below content: ``` plugin.class=ro.fortsoft.pf4j.demo.welcome.WelcomePlugin @@ -201,6 +203,24 @@ Also, you can control plugin instance creation overriding `createPluginFactory` For more information please see the demo sources. +** Note** If your application didn't find extensions then make sure that you have a file with name `extensions.idx` +generated by PF4J in the plugin jar. +It's most likely that they are some problems with the annotation processing mechanism from Java. +O possible solution to resolve your problem is to add a configuration to your maven build. +The `maven-compiler-plugin` can be configured to do this like so: +``` + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + + ro.fortsoft.pf4j.processor.ExtensionAnnotationProcessor + + + +``` + Plugin assembly ------------------------------ After you developed a plugin the next step is to deploy it in your application. For this task, one option is to create a zip file with a structure described in section [How to use](https://github.com/decebals/pf4j/blob/master/README.md#how-to-use) from the beginning of the document. @@ -376,6 +396,14 @@ You can plug your custom `ExtensionStorage` implementation in `ExtensionAnnotati For example if I want to use `ServiceProviderExtensionStorage` then the value for the `pf4j.storageClassName` key must be `ro.fortsoft.pf4j.processor.ServiceProviderExtensionStorage` +**NOTE:** `ServiceLoaderExtensionFinder`, the class that lookups for extensions stored in `META-INF/services` folder, is +not added/enabled by default. To do this please override `createExtensionFinder` from `DefaultPluginManager`: +```java +protected ExtensionFinder createExtensionFinder() { + return ((DefaultExtensionFinder) super.createExtensionFinder()).addServiceProviderExtensionFinder(); +} +``` + Demo ------------------- I have a tiny demo application. The demo application is in demo folder.