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()
}
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
}
}
@Plugin(name = "test")
public final class ExamplePlugin extends ReposilitePlugin {
@Override
public @Nullable Facade initialize() {
extensions().registerEvent(ReposiliteInitializeEvent.class, event -> {
getLogger().info("");
getLogger().info("--- Example plugin");
getLogger().info("Example plugin has been properly loaded");
});
return null;
}
}
/resources/META-INF/services/com.reposilite.plugin.api.ReposilitePlugin
:example.ExamplePlugin
gradle shadowJar
task and put output file in plugins
directory located in working directory of your Reposilite instance.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?
Copyright © 2023 dzikoysk with ❤ panda-lang