All Projects → souzen → light-jpf

souzen / light-jpf

Licence: other
Lightweight Java Plugin Framework

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to light-jpf

gatling-maven-plugin
Gatling Plugin for Maven
Stars: ✭ 30 (+57.89%)
Mutual labels:  maven, maven-plugin
dependency-update-maven-plugin
A Maven plugin that creates merge requests for dependency updates.
Stars: ✭ 23 (+21.05%)
Mutual labels:  maven, maven-plugin
mvn-jlink
Maven plugin to provide way to work with jlink tool in maven projects
Stars: ✭ 34 (+78.95%)
Mutual labels:  maven, maven-plugin
mvn scalafmt
Scalafmt plugin for maven
Stars: ✭ 14 (-26.32%)
Mutual labels:  maven, maven-plugin
mosec-maven-plugin
用于检测maven项目的第三方依赖组件是否存在安全漏洞。
Stars: ✭ 85 (+347.37%)
Mutual labels:  maven, maven-plugin
macosappbundler-maven-plugin
Maven plugin for creating a native macOS bundle containing all dependencies required by a Maven project
Stars: ✭ 35 (+84.21%)
Mutual labels:  maven, maven-plugin
plexus-compiler
Plexus compiler a layer on top of compilers and used by maven-compiler-plugin
Stars: ✭ 24 (+26.32%)
Mutual labels:  maven, maven-plugin
Formatter Maven Plugin
Formatter Maven Plugin
Stars: ✭ 187 (+884.21%)
Mutual labels:  maven, maven-plugin
restdocs-spec
A maven plugin for generating Open API and Postman Collection specifications using Spring Restdocs.
Stars: ✭ 43 (+126.32%)
Mutual labels:  maven, maven-plugin
jcabi-mysql-maven-plugin
MySQL Maven Plugin: starts MySQL server on pre-integration phase and shuts it down on post-integration phase
Stars: ✭ 34 (+78.95%)
Mutual labels:  maven, maven-plugin
markdown-page-generator-plugin
Markdown to HTML Page Generator Maven Plugin
Stars: ✭ 48 (+152.63%)
Mutual labels:  maven, maven-plugin
jaxws-maven-plugin
www.mojohaus.org/jaxws-maven-plugin/
Stars: ✭ 18 (-5.26%)
Mutual labels:  maven, maven-plugin
Docker Maven Plugin
INACTIVE: A maven plugin for Docker
Stars: ✭ 2,597 (+13568.42%)
Mutual labels:  maven, maven-plugin
snyk-maven-plugin
Test and monitor your projects for vulnerabilities with Maven. This plugin is officially maintained by Snyk.
Stars: ✭ 64 (+236.84%)
Mutual labels:  maven, maven-plugin
Versions Maven Plugin
Versions Maven Plugin
Stars: ✭ 199 (+947.37%)
Mutual labels:  maven, maven-plugin
dmn-check
A tool which performs static analyses on Decision Model Notation (DMN) files to detect bugs
Stars: ✭ 34 (+78.95%)
Mutual labels:  maven, maven-plugin
Maven Git Versioning Extension
This extension will virtually set project versions, based on current git branch or tag.
Stars: ✭ 178 (+836.84%)
Mutual labels:  maven, maven-plugin
Sortpom
Maven plugin that helps the user sort pom.xml.
Stars: ✭ 185 (+873.68%)
Mutual labels:  maven, maven-plugin
ktlint-maven-plugin
Maven plugin for ktlint the Kotlin linter
Stars: ✭ 42 (+121.05%)
Mutual labels:  maven, maven-plugin
buildnumber-maven-plugin
BuildNumber Maven Plugin
Stars: ✭ 53 (+178.95%)
Mutual labels:  maven, maven-plugin

Lightweight Java Plugin Framework

Maven Central Travis

1. Features

  • Simple api
  • Sandboxing with custom java classloader
  • Build plugins with maven

2. Usage

2.1 Create plugin

Create Plugin class that implements ljpf.Plugin interface.

public class CustomPlugin implements Plugin {

    @Override
    public void load() {
        ...
    }

    @Override
    public void unload() {
        ...
    }
}

Create descriptor file for corresponding plugin and place it in project resources. Descriptor file must have .plugin extension.

src/main/resources/custom.plugin

id=CustomPluginId
version=0.0.1
pluginClass=ljpf.examples.plugin.CustomPlugin
description=My Custom plugin

2.2 Create app

Load plugins in your main application using PluginManager interface. Use plugin id from descriptor file to load extensions. Plugin repository determines way of loading plugins. Base case is to load jars from classpath plugins/ directory.

public class App {

    public static void main(String[] args) {

        PluginRepository pluginRepository = new DirPluginRepository("plugins");
        PluginManager pluginManager = new DefaultPluginManager(pluginRepository);

        pluginManager.load("CustomPluginId");
    }

}

2.3 Build with Maven

Build plugin with Maven

Use light-jpf-maven-plugin to create maven artifact (*-plugin.jar). Maven will create fat jar with plugin code and all its dependencies.

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.souzen</groupId>
                <artifactId>light-jpf-maven-plugin</artifactId>
                <version>0.0.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>make-plugin</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        ....    
    
    </build>

Add plugins to app

light-jpf-maven-plugin can also prepare plugins/ directory in your application.

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.souzen</groupId>
                <artifactId>light-jpf-maven-plugin</artifactId>
                <version>0.0.2</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>make-plugin-repository</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/plugins</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>ljpf.examples.plugin</groupId>
                                    <artifactId>custom-plugin</artifactId>
                                    <version>0.0.1</version>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            ... 
               
        </plugins>
        ....    
    
    </build>

3. Plugin Repositories

DirPluginRepository

TODO Loads plugins from given directory

ClasspathPluginRepository

TODO Loads plugins from java classpath

MultiPluginRepository

TODO Enables mixing multiple plugin reposiotories

4. Debugging

In app create plugins dir and run or place plugins as dependencies

    <dependencies>
        <dependency>
            <groupId>ljpf.examples.plugin</groupId>
            <artifactId>custom-plugin</artifactId>
            <version>0.0.1</version>
        </dependency>
        ...
        
    </dependencies>

5. Examples

See example project here

Build and run example

mvn clean package
unzip examples/app/target/app-0.0.3-SNAPSHOT-bin.zip
./app-0.0.3-SNAPSHOT/start.bat

6. Licence

Copyright 2017 Luke Sosnicki

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].