Browse Source

Improve readme

pull/94/merge
Decebal Suiu 9 years ago
parent
commit
457869eb0f
  1. 30
      README.md

30
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)
<!--
[![Coverage Status](https://coveralls.io/repos/decebals/pf4j/badge.svg?branch=master&service=github)](https://coveralls.io/github/decebals/pf4j?branch=master)
-->
[![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:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<annotationProcessors>
<annotationProcessor>ro.fortsoft.pf4j.processor.ExtensionAnnotationProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
```
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.

Loading…
Cancel
Save