Compiling from Source
Relevant source files
The following files were used as context for generating this wiki page:NexAuth uses the Gradle build automation system to compile the project from its source code. The repository includes a Gradle Wrapper (gradlew), which simplifies the compilation process by automatically downloading and using the correct version of Gradle. This ensures a consistent build environment for all developers.
The project is structured into multiple modules, including an API and a Plugin module, to support various Minecraft server platforms like Paper, Velocity, and BungeeCord. The build system is configured to manage dependencies, process platform-specific plugin descriptors, and generate the final JAR artifacts.
Sources: gradlew.bat, CHANGELOG.md:23, README.md:49
Prerequisites
Before compiling, ensure your development environment has the following software installed.
| Software | Version/Requirement | Notes |
|---|---|---|
| Java Development Kit (JDK) | 21+ | The project requires Java 21 or newer to compile and run. The build script will look for JAVA_HOME. |
| Git | Latest | Required to clone the repository from GitHub. |
Sources: CHANGELOG.md:29, README.md:5, gradlew.bat:43-56
Build Process
The compilation is handled by Gradle tasks. The included wrapper script (gradlew for Linux/macOS and gradlew.bat for Windows) is the recommended way to execute these tasks.
Steps to Compile
-
Clone the Repository:
git clone https://github.com/Xreatlabs/NexAuth.git cd NexAuth -
Run the Build Task:
Execute the GradlebuildorshadowJartask using the wrapper. TheshadowJartask is used to create an executable JAR with all necessary dependencies bundled.On Windows:
gradlew.bat shadowJarOn Linux/macOS:
./gradlew shadowJar
Upon successful completion, the compiled JAR file will be located in the Plugin/build/libs/ directory.
Sources: gradlew.bat:69, CHANGELOG.md:46
Build Flow
The diagram below illustrates the high-level process when you run the build command.
This diagram shows the automated steps taken by the Gradle Wrapper to produce the final plugin artifact.
Sources: gradlew.bat, CHANGELOG.md:23, 46
Project Structure and Dependencies
NexAuth is a multi-module Gradle project designed for cross-platform compatibility.
Key Files and Directories
| File/Directory | Purpose |
|---|---|
API/ | Contains the NexAuth API, allowing other plugins to integrate with it. |
Plugin/ | Contains the core implementation for different platforms (e.g., Paper). |
gradlew / gradlew.bat | Gradle wrapper scripts for building the project. |
plugin.yml | The plugin descriptor for Bukkit/Spigot platforms. The version is tokenized ('${version}'). |
paper-plugin.yml | The plugin descriptor for the Paper platform, specifying dependencies and load order. |
NexLimbo | Integrated as a local subproject for the limbo server functionality. |
Sources: API/src/main/java/xyz/xreatlabs/nexauth/api/util/SemanticVersion.java, Plugin/src/main/java/xyz/xreatlabs/nexauth/paper/PaperBootstrap.java, gradlew.bat, plugin.yml, paper-plugin.yml, CHANGELOG.md:24
Dependency Management
NexAuth uses a combination of compile-time and runtime dependency management.
-
Gradle Dependencies: Build-time dependencies are declared in Gradle's build scripts and are automatically downloaded during the build process.
-
Runtime Libraries (Libby): For the Paper platform, NexAuth uses
PaperLibraryManager(a part of the Libby library) to download required libraries at runtime. This is initiated in theonLoadmethod of thePaperBootstrapclass, which reads a JSON configuration to determine which libraries to load. This keeps the final plugin JAR size smaller.// Source: Plugin/src/main/java/xyz/xreatlabs/nexauth/paper/PaperBootstrap.java:36-46 LibraryManager libraryManager; try { Class.forName("io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader"); libraryManager = new PaperLibraryManager(this); } catch (ClassNotFoundException e) { libraryManager = new BukkitLibraryManager(this); } getSLF4JLogger().info("Loading libraries..."); try { libraryManager.configureFromJSON(); } catch (Exception e) { getSLF4JLogger().error("Failed to load libraries, stopping server to prevent damage", e); stopServer(); } -
Platform Dependencies: The plugin depends on other server plugins like
floodgateandLuckPerms. These are declared assoftdependordependenciesin theplugin.ymlandpaper-plugin.ymlfiles, indicating they should be loaded before NexAuth.# Source: Plugin/src/main/resources/paper-plugin.yml:6-15 dependencies: server: Geyser-Spigot: load: "BEFORE" required: false floodgate: load: "BEFORE" required: false LuckPerms: load: "BEFORE" required: false -
Subprojects: The
NexLimbosystem, which provides the authentication limbo server, is integrated as a local subproject. This means it is compiled and included as part of the main NexAuth build process, ensuring tight integration.
Sources: Plugin/src/main/java/xyz/xreatlabs/nexauth/paper/PaperBootstrap.java:36-46, paper-plugin.yml:6-15, plugin.yml:6-10, CHANGELOG.md:24