# PlotSquared Compilation Guide This guide covers two methods to build PlotSquared from source: 1. **Docker (Recommended):** Automated, clean, and isolated. 2. **Manual (Debian):** Standard setup on a Linux VM. --- ## Option 1: The Docker Automation (Recommended) This method builds the plugin inside a temporary container and exports the final JARs to a clean `output` folder, keeping your host machine clean. ### 1. The Dockerfile Create a file named `Dockerfile` in an empty folder: ```dockerfile # Use a lightweight image with Java 21 (Eclipse Temurin is widely used for Minecraft) FROM eclipse-temurin:21-jdk-jammy # Install git since the base image might not have it RUN apt-get update && apt-get install -y git WORKDIR /build # 1. Clone the repo RUN git clone https://github.com/IntellectualSites/PlotSquared.git . # 2. Checkout a specific version. # Change '7.5.11' to the specific tag/version you need. # You can find tags by running `git tag` in a manual clone or checking GitHub releases. RUN git checkout 7.5.11 # 3. Build using the wrapper # --no-daemon: Prevents Gradle from starting a background process (useless in a temp container) # clean build: Ensures a fresh compilation RUN chmod +x gradlew RUN ./gradlew clean build --no-daemon # This command lists the files so you can verify the build succeeded if you check logs CMD ["ls", "-l", "Bukkit/build/libs/"] ``` ### 2. The Build & Run Commands Run these commands in the terminal where your `Dockerfile` is located. ```bash # 1. Build the Docker image docker build -t p2-builder . # 2. Create the output directory locally (to avoid permission issues) mkdir -p output # 3. Run the container and extract the JARs # -v "$(pwd)/output:/export": Maps your local 'output' folder to the container's '/export' folder # sh -c "...": Runs the copy command using a wildcard to catch both the main jar and the sources jar docker run --rm -v "$(pwd)/output:/export" p2-builder sh -c "cp Bukkit/build/libs/*.jar /export/" ``` **Result:** You will find the compiled JAR files in the `output/` folder in your current directory. --- ## Option 2: The Manual Method (Debian) Use this if you are working directly on a VM and prefer to manage dependencies yourself. ### 1. Install Dependencies PlotSquared requires Java 21 or higher. ```bash sudo apt update sudo apt install git openjdk-21-jdk ``` ### 2. Clone and Prepare Cloning usually gives you the unstable "dev" branch. You must checkout a specific tag to get a stable release. ```bash # Clone the repository git clone https://github.com/IntellectualSites/PlotSquared.git cd PlotSquared # List available versions (optional, to help you choose) git tag --sort=-creatordate | head -n 10 # Checkout the specific version you want (e.g., 7.5.11) git checkout 7.5.11 ``` ### 3. Compile Use the included Gradle wrapper. ```bash # Make the wrapper executable chmod +x gradlew # Run the build # We add --no-daemon here too, as it is generally cleaner for one-off builds ./gradlew clean build --no-daemon ``` ### 4. Locate the File The final JARs will be located deep in the directory structure. You can move them to your current folder with: ```bash # Copy the compiled JARs to your current folder cp Bukkit/build/libs/*.jar . ```