Build logic for Minecraft server plugins
io.github.mcengine.build-logic configures a whole multi-module Bukkit, Spigot, Paper or Folia plugin build from one plugins { } line: the Java toolchain, UTF-8, repositories, GitHub Packages publishing for the modules other plugins compile against, and Shadow for the module that becomes the server jar.
Why it exists
A Minecraft plugin that runs on several server platforms is usually split into modules: a pure Java api other plugins compile against, a common core, a bukkit layer, one thin entry point per platform, and an engine module that shades them all into the one jar a server loads. Every such project ends up with the same 60 line root build.gradle: allprojects { } for group, version and repositories, subprojects { } for the toolchain and encoding, publishing for the library modules, and Shadow for the jar. Copied between repositories, those blocks drift.
This plugin is that root build, versioned and tested. Applying it replaces the copied blocks, and every repository that applies the same version builds the same way.
It is used by more than fifteen plugins in the MCEngine family, but it assumes nothing about them: the names it publishes under and the modules it touches come from your own gradle.properties and an optional mcengineBuild { } block.
A whole root build
With the plugin, a root build.gradle is this:
plugins {
id 'io.github.mcengine.build-logic' version '0.2.0'
}
and gradle.properties names the project:
project-group=io.github.example
project-version=1.0.0
git-org-name=Example
git-repository=example-plugin
Every module with a build file then compiles with the Java 25 toolchain; api, common and bukkit publish to https://maven.pkg.github.com/Example/example-plugin as example-plugin-api and so on; and engine builds the shaded jar. Each of those choices can be changed in mcengineBuild { }.
What it configures
| Projects | Gets |
|---|---|
| Every project | group and version from project-group and project-version; mavenCentral() |
| Every subproject with a build file | The java plugin, the Java toolchain (25 by default) and UTF-8 compilation |
Modules in publishedModules | maven-publish, the GitHub Packages repository, a {rootProject.name}-{module} artifactId and the POM |
Modules in shadowModules | com.gradleup.shadow, which the plugin puts on the build classpath |
| The root project | A clean task, unless the root build declares one |
The details, and when each step runs, are in What it configures.
Documentation
Getting started
Apply the plugin to a new or existing multi-module plugin build in three files.
Open →What it configures
Group and version, the Java toolchain, repositories, publishing and Shadow, project by project.
Open →Configuration
The mcengineBuild { } block: every property, its default, and the errors it raises.
Publishing
How the listed modules publish to GitHub Packages with collision free artifactIds.
Open →Migrating a build
Replace a copied allprojects and subprojects root build without changing its output.
Change log
What changed in each release.
Open →Requirements
- Gradle 9. The plugin is compiled for Java 17, the lowest JVM Gradle 9 runs on.
- A JDK for the toolchain you build with (Java 25 by default). With the
org.gradle.toolchains.foojay-resolver-conventionsettings plugin Gradle downloads it. - Apply it to the root project only. Applied to a module it stops the build with an error.