Skip to content

dolphin2410-archive/WebJelly

Repository files navigation

WebJelly

Load Maven Artifacts to Runtime

WebJelly is a plugin that supports a library-loading feature for artifacts in which are not in the MavenCentral repository.

The Problem

Let's say you have your own repository server named

https://example.com/repo/

You want to use myproject artifact in there, but you can't go like

name: MyPlugin
main: io.github.xxx.plugin.MyPlugin
version: 1.0
libraries:
  - com.example.myproject:myproject:1.0

because the myproject artifact is not in the MavenCentral repository.

The solution

As most of you are aware, you can't modify the spigot's library loading system to support not only maven-central but also one of yours. So I decided to make my own plugin-loading system that has the dependencies you want in your runtime.

webjelly.json

webjelly.json should be in the resources directory of your source-code. It should be placed in the root directory of your jar plugin. You can use it like the following

{
  "<repository>": [
    "artifact1",
    "artifact2"
  ],
  "<another_repository>": [
    "artifact3"
  ]
}

So in the case when you want to load myproject from https://example.com/repo/, you can use

{
  "https://example.com/repo/": [
    "myproject"
  ]
}

MavenCentral and MavenLocal is also supported

{
    "mavenLocal": [
        "myproject"
    ],
    "mavenCentral": [
        "myproject2"
    ]
}

Using Your Plugin

The tree should be like this

├── plugins
│   ├── webjelly
│   │   └── myplugin.jar
│   └── webjelly.jar
├── ...

Your plugin should be located in the webjelly directory inside the plugins folder, not directly in the plugins folder. You should create the webjelly directory if it doesn't exist