Build a Minecraft mod with Forge
Forge projects are tightly tied to Minecraft, Forge, and Gradle releases. Preserve the project's configuration before upgrading or cleaning it.

Forge is a mod loader, not a server-plugin API
Forge is a Minecraft modding framework and loader. A Forge mod targets the Forge environment; it does not become a Bukkit or Paper plugin just because both outputs are JAR files. A mod may need Forge installed on the server and, if it adds client-side content or behavior, on the player’s client as well. Read the project documentation to see which side is required. Do not put a Forge mod in plugins and expect Paper to load it.
Forge projects commonly use Gradle and ForgeGradle, with root configuration such as settings.gradle, build.gradle, and a wrapper. META-INF/mods.toml declares mod information and requirements in many releases. Older projects may use a different format, so follow the scaffold generated for the project's Minecraft target instead of copying a current template from the web.
Keep Forge versions aligned
A Forge release is tied to a Minecraft release and its development setup; a mod built for one game version does not automatically move to the next. Use the build file, descriptor, and runtime log to identify the exact target. Upgrading ForgeGradle or Minecraft can require changes to mappings, tasks, or API names. Keep a copy of the original configuration before removing generated files, and do not replace a dependency version without checking the matching release notes.
NeoForge is a separate development path for some Minecraft releases, not a drop-in name for an older Forge dependency. Inspect the source platform, imports, and metadata. If a repository contains separate Forge and NeoForge modules, upload the root that preserves module settings and select the correct artifact after building. The platform overview helps distinguish them, while Fabric covers a different loader entirely.
Gradle and ForgeGradle
Keep the Gradle wrapper because it pins the expected tool version. ForgeGradle is compatible with particular Gradle and Java releases; if project configuration fails, check those versions before editing source. ForgeGradle may also need specific repository or metadata settings, so a Forge build is not just a generic Java project even though it uses Gradle.
Do not delete gradle.properties or shared settings when they define the Forge, Minecraft, or mapping versions. Generated .gradle and build folders can usually be removed. If the project uses a local JAR or a private repository, confirm the dependency is available in the build environment and never put credentials in the ZIP. The general Gradle guide explains the file structure, but ForgeGradle configuration should remain compatible with the project's original scaffold.
Resources and mods.toml
Confirm that mods.toml is in the location Forge expects, commonly under META-INF in the resources, and that it declares the mod ID, requirements, and versions correctly. Check that loader and Minecraft ranges match the environment where you plan to run the file. A descriptor can be syntactically valid but declare the wrong range, causing Forge to reject the mod before loading code.
Resources such as language files, images, and recipe data need to be packaged from the resources directory. Open the output as an archive and verify the paths and artifact name. Some build scripts produce test or source artifacts as well; do not choose a -sources file instead of the runtime mod. Use the Gradle log to identify which task created each output.
Java and game runtime requirements
The Java requirement follows the Minecraft release and platform, while Gradle itself also has a runtime requirement. Gradle may run on one Java version and use another toolchain to compile the mod. Check the project's Java settings and environment log instead of assuming a newer JDK solves every issue. invalid source release: 21 means the selected compiler is older than the requested target. Unsupported class file major version 65 may come from Gradle or a runtime that cannot read Java 21 bytecode. See the chart and Java troubleshooting page.
From ZIP to a real test
Archive the Forge project root with its wrapper, settings, source, and resources; remove stale generated output that can be recreated. Do not include personal data, keys, or private configuration. After a successful build, inspect mods.toml, compiled classes, and resources in the JAR. Then launch a test installation matching the Minecraft, Forge, and Java versions. The loading log is more useful than simply noticing that the mod is absent from a list.
If Gradle fails before compilation, check the wrapper, ForgeGradle, and repository versions. If the compiler cannot find a symbol, the source may target a different API. If the build passes but Forge rejects the artifact, check mods.toml and its version ranges. NoClassDefFoundError can indicate a missing dependency or class unavailable at runtime. The troubleshooting guide helps locate the stage, and the ZIP build guide covers archive preparation.
An older project is not a current template
Forge has changed across Minecraft generations; an older project may use task names and metadata formats that differ from current ForgeGradle. Do not replace its entire build.gradle with a random new template just because a newer Gradle release is available. Identify the game and Forge versions first and use documentation or a scaffold that matches them. Updating Minecraft may require mappings and import changes, not only a dependency-number change.
Before cleaning, keep a copy of wrapper files and Gradle properties. Remove only output and cache folders that can be recreated. If a build fails after a ForgeGradle upgrade, start with the failed task and compare the change with examples for the target release. If the build passes but the loader rejects the mod, inspect version ranges in mods.toml against the Forge runtime.
Choose the artifact you intend to install
Forge builds may produce several JARs: the runtime mod, a source artifact, or output from internal modules. Use the task log and filename to identify the runtime artifact. Inspect mods.toml, classes, and resources in the package, then match the mod ID and version to what the loader reports. If the file exists but Forge does not list it, read the first warning or error while scanning the mods folder before changing the build.
Do not confuse a test artifact with a distribution build. Some configurations require a task that packages resources or copies metadata. After confirming the output, test it in a clean Forge installation with the matching game release. Record required companion mods; one missing library can prevent loading even when the primary JAR compiled successfully.