Table of Contents

Plugin system has been introduced in Reposilite 3.x and allows users to extend & customize their instances.

Preferred build for plugins is with .
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

group = "example.plugin"

plugins {
    id("com.github.johnrengelman.shadow") version "7.1.1"
}

application {
    mainClass.set("example.plugin.TestPluginKt")
}

dependencies {
    compileOnly("com.reposilite:reposilite:3.0.2")
}

tasks.withType<ShadowJar> {
    archiveFileName.set("example-plugin.jar")
    destinationDirectory.set(file("$rootDir/reposilite-backend/src/test/workspace/plugins"))
    mergeServiceFiles()
}

Every plugin has to provide com.reposilite.plugin.api.ReposilitePlugin implementation:
@Plugin(name = "example")
class ExamplePlugin : ReposilitePlugin {

  override fun initialize(): Facade? {
    event { event: ReposiliteInitializeEvent ->
      logger.info("")
      logger.info("--- Example plugin")
      logger.info("Example plugin has been properly loaded")
    }

    return null
  }

}
The last thing you need to do is a declaration of a service file in resources directory that tells what's the main class in your plugin:
  • /resources/META-INF/services/com.reposilite.plugin.api.ReposilitePlugin:
example.ExamplePlugin
Then, just run gradle shadowJar task and put output file in plugins directory located in working directory of your Reposilite instance.

List of classes and functions:

Facade is just a name for class that exposes public functions to other domains (API). The difference between Facade and Service is in the visibility - Service is meant to use and handle internal implementation, Facade for external users. You can find more about used architecture here:

Did you find misleading or deprecated content? Maybe you just feel this section misses important elements?

Guide

Copyright © 2023 dzikoysk with ❤ panda-lang