In this tutorial, you'll learn how to write a jar plugin on JVM, we'll use both Java and Kotlin to program this demo plugin. And we'll discuss more advanced features, so you can choose some you needed parts to read, other parts can be read at any time later.
We strongly recommend programing in kotlin.
First step, we need to use intellij idea to create a java project named java-demo-plugin
using gradle as the build tool, and choosing kotlin as the gradle dsl.
settings.gradle.kts
content as follows:
build.gradle.kts
content as follows:
Refer our kotlin gradle template.
Create plugin-spec.yml
in project directory, writing content as follows:
id: runflow.java
name: Java Plugin
entry: ./java-demo-plugin.jar
customize-loader: default
version: 1.0.0
compatible-version:
since-build: 961
until-build: 961
Create a MainTest.java
file locate in src/test/java
, the codes like following:
Run MainTest
, you'll see the action window, here is no any plugins, even no builtin plugin, it's simple and base implemented only, just for plugin developing and testing.
-
Cycle Listener interprets how to listen plugin loading state.
-
Action interprets how to write a general action, and an action of customized ui.
-
Placeholder interprets how to update our placeholder.
-
Theme interprets how to update our theme.
-
Action Callback Extension interprets how to extend action callbacks.
-
Storing Data interprets how to store data by using our builtin database, and some requirements.
-
Data Encryptor interprets how to provide data encryptors for data sync service.
-
Data Sync Service interprets how to provide data sync methods for user.
-
Translator interprets how to provide language translator for user to translate bundled language resources.
-
Action Focused Mode interprets how to write an action that supports focused mode.
-
Toolbar interprets how to write a toolbar.
-
Func Page interprets how to write a func page with gui.
-
Action Window interprets how to replace our action window.
-
Http Service interprets how to use our builtin http service to expose endpoint.
-
Bundle Language interprets how to bundle language resource to java bean.
-
Localization Matcher interprets how to help us get more user-friendly results when looking for keywords.
-
Utilities interprets all the useful classes, methods and fields.