komga-enhanced

example-komga-plugin

A ready-to-build template for a Komga (fork) plugin. See the full guide in ../../PLUGINS.md.

Build

./gradlew build
# -> build/libs/example-komga-plugin-1.0.0.jar

Requires JDK 21 (same as building Komga).

What’s inside

Install

Class-loader isolation

Komga loads each plugin under a SpiOnlyClassLoader that whitelists only:

Trying to import anything else from Komga (org.gotson.komga.domain.…, Spring, SLF4J, …) fails at runtime with ClassNotFoundException("Plugin denied access to '…' — class-loader isolation. …"). Anything you genuinely need — OkHttp, SQLite-JDBC, your own libraries — must be implementation(...) in build.gradle.kts so it ends up inside your plugin JAR; the plugin’s private URLClassLoader serves them after the parent rejects.

This is isolation, not a sandbox: java.io.File, java.net.http and java.lang.reflect are intentionally allowed. See PLUGINS.mdSecurity model in the fork root for the full statement of limits.