Add the Paper Repository
Add the Paper Maven repository to yourbuild.gradle.kts file:
build.gradle.kts
repo.papermc.io hosts all Paper API releases and snapshots.
Add the Paper API Dependency
Add the Paper API as a compile-only dependency:build.gradle.kts
Use
compileOnly (not implementation) because the Paper server provides the API at runtime. This prevents bundling the API into your plugin JAR.Configure Java Toolchain
Paper requires Java 21. Configure the Java toolchain in your build file:build.gradle.kts
Complete Example
Here’s a completebuild.gradle.kts for a Paper plugin:
build.gradle.kts
Version Selection
The Paper API version corresponds to the Minecraft version:1.21.11-R0.1-SNAPSHOT- Development version for Minecraft 1.21.11- Update the version to match your target Minecraft release
- The
-SNAPSHOTsuffix indicates an actively developed version
Groovy DSL
If you prefer Groovy DSL (build.gradle), use this syntax:
Build Your Plugin
Compile and build your plugin JAR:build/libs/.
Next Steps
After setting up Gradle integration:- Create your plugin main class extending
JavaPlugin - Add a
paper-plugin.ymlorplugin.ymlfile - Build with
./gradlew build - Deploy your plugin to a Paper server