Build a Minecraft plugin with Maven
Maven manages dependencies and build phases from pom.xml. Keep the configuration explicit and match Java and Paper API to your target server.

Start with a clear project layout
A small Maven project has pom.xml at its root, Java code under src/main/java, and files such as plugin.yml under src/main/resources. Maven copies resources into the final artifact and compiles code through its lifecycle phases. A multi-module project has a parent POM that declares modules, with settings in each module. Upload the parent root; uploading only one subfolder can lose shared version and repository settings.
Remove target before making a ZIP if you do not need old outputs. Keep the parent POM, source, and resources. The .mvn/wrapper folder and mvnw script pin a Maven release for a team; include them if the project depends on them. The ZIP preparation guide explains how to clean generated files without deleting project configuration.
Set Java in one clear place
Use a property such as maven.compiler.release to set the Java target. A minimal example is:
<properties>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
This setting does not install JDK 21 by itself; the active compiler must support that release. If invalid source release: 21 appears, check the JDK used inside Maven, then search parent POMs and profiles for conflicting source and target values. Do not set 17 and 21 in different places and expect Maven to guess. See the source release 21 guide and the Java chart.
Add Paper API as a build dependency
If the plugin targets Paper, add the Paper repository and a paper-api dependency at a version that fits the project. A Maven dependency commonly uses provided scope because the server supplies the API at runtime. Choose a release compatible with the Paper and Minecraft version you plan to test instead of copying a random latest number. Spigot projects may use spigot-api from its appropriate repository. Do not package the server API in an ordinary plugin JAR; it can cause classloader conflicts.
Confirm that source imports match the declared API. If the compiler says package org.bukkit does not exist, check the repository, artifact name, and scope. If Maven reports Could not resolve, verify the repository URL, dependency version, and network access from the build environment. Never put private repository credentials in an uploaded POM; use protected settings outside the ZIP.
Add plugin.yml
A traditional plugin descriptor can look like this:
name: ExamplePlugin
version: 1.0.0
main: com.example.plugin.Main
api-version: '1.20'
Make the main value match the actual package and class, and save the file at src/main/resources/plugin.yml. After building, it should appear at the archive root. api-version declares the plugin API level; it is not the Java version. If the server rejects it, check the server release and APIs used by the source, then read the Unsupported API version guide before changing the value.
Run Maven and inspect the output
A common local command is ./mvnw clean package on macOS/Linux or mvnw.cmd clean package on Windows when the wrapper exists. clean removes previous output and package runs configured compilation and tests before creating the artifact. Read the first error. BUILD SUCCESS does not prove the plugin worked in-game; it means the Maven goals that ran completed.
Find the JAR under target and open it. Check for .class files, plugin.yml, and resources. If the build created a -sources artifact or a JAR without dependencies, do not assume it is the installable file. Shading or packaging a library has a specific purpose; use it only for libraries the server does not provide. See NoClassDefFoundError if a class is missing at runtime.
Upload and test the project
To build with NYXO JAR, compress the source, POM, and resources into a ZIP and upload the project root. Review the detected version, platform, and tool summary. After downloading, test the JAR on a matching Paper staging server. Read the startup log and check commands, events, and dependencies. Do not upload production data or keys. For a Java message, compare the environment with the version chart; for an API issue, compare the POM and descriptor with the server release.
Diagnosis is faster when you record Maven, JDK, Paper, and Minecraft versions and keep the first complete error. For the difference between building and changing a file extension, read the comparison. For other platforms, start at the platform overview instead of reusing Paper settings for a Fabric or Forge project.
Manage Maven modules and dependencies
In a multi-module build, use the parent POM to manage shared plugin and dependency versions, and declare only the dependencies each module needs. Do not add Paper API to a mod module or the reverse. For a runtime library, decide whether the server provides it or the artifact must include it. Adding a version under dependencyManagement can manage its version without adding it to the classpath; the module still needs an actual dependency declaration.
Check which lifecycle phases the project runs. A plugin that generates sources or copies files may require a specific task before package. In a local environment, mvn help:effective-pom can clarify inherited values; do not share its output if it contains private settings. If dependency download fails, verify the repository and release in a clean environment rather than replacing the library with an unknown source.
Dependency and descriptor checks
A POM connects the compiler, platform dependency, and packaging lifecycle. For Paper, confirm the API dependency comes from the right repository and uses a scope that reflects the server providing it at runtime. A standalone library needed by the plugin may instead need packaging or separate installation. Do not mark every dependency provided to reduce file size or bundle all dependencies automatically; they have different roles.
After changing the POM, run a clean build and verify the artifact name and contents. For a multi-module project, build from the root so shared settings apply. The effective POM can reveal values inherited from a parent or profile. Do not release a sources-only or non-final JAR. Keep the successful settings with the JDK and Maven versions so you can reproduce the build in CI or a build service.
Tests are more than compilation
The Maven test phase may run unit tests or file checks, but it does not launch Paper unless the project explicitly configures that integration. Read the reports to see what ran. A successful package confirms the configured Maven goals completed; you still need a Paper test server to load the plugin. Track unit tests, JAR structure checks, and runtime tests separately.