You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by tz...@apache.org on 2022/08/08 13:41:43 UTC

[apisix-java-plugin-runner] branch main updated: docs: write documentation for shipping plugin (#179)

This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
     new e064f64  docs: write documentation for shipping plugin (#179)
e064f64 is described below

commit e064f64a1d0b838dbd7942c579905bc127e32328
Author: Eric Liu <54...@users.noreply.github.com>
AuthorDate: Mon Aug 8 06:41:39 2022 -0700

    docs: write documentation for shipping plugin (#179)
---
 docs/en/latest/writing-filters.md | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/docs/en/latest/writing-filters.md b/docs/en/latest/writing-filters.md
index c77a105..78868fe 100644
--- a/docs/en/latest/writing-filters.md
+++ b/docs/en/latest/writing-filters.md
@@ -19,12 +19,14 @@
 
 # Overview
 
-This document explains how to develop Java plugins using apisix-java-plugin-runner's official Maven release.
+This document explains how to develop and ship Java plugins using apisix-java-plugin-runner's official Maven release.
 
 A Demo Project can be found at: https://github.com/tzssangglass/java-plugin-runner-demo-1
 
 ___
 
+### Write Java plugin
+
 Create a new Maven Spring Boot Project.
 
 Add the GAV of `apisix-java-plugin-runner` in `pom.xml`.
@@ -152,6 +154,23 @@ socket.file = /tmp/runner.sock
 ```
 This allows our java-plugin-runner to communicate with the main APISIX process.
 
-Finally, build your Java plugin! Be sure to label each filter class as a Spring *@Component* while following the guide at:
+Build your Java plugin! Be sure to label each filter class as a Spring *@Component* while following the guide at:
 https://github.com/apache/apisix-java-plugin-runner/blob/main/docs/en/latest/development.md
 
+### Ship plugin
+
+In your plugin's *pom.xml*, add
+```
+<configuration>
+    <classifier>exec</classifier>
+</configuration>
+```
+
+The standard Spring Boot executable JAR places all of your application classes inside *BOOT-INF/classes*, making it impossible to inject into another project. This config builds an additional non-executable JAR that can be used for dependency injection.
+
+Deploy the JARs to Maven Central.
+
+### Using a deployed plugin
+
+To use someone else's plugin, add their plugin's non-executable JAR as a dependency in your project. Add the package name of their filters (usually the same as the Group ID) in *scanBasePackages* in your main SpringBootApplication class to allow Spring to find the plugin *@Component*.
+