Skip to content

Installing Quark-J8

Quark-J8 provides a Gradle plugin that seamlessly integrates with your build script. To apply it:

plugins {
    id("java-library")
    id("com.gradleup.shadow") version "8.3.11"
    id("org.vaelow233.quark") version "1.3.0"
}

Then, add your dependencies using the quark configuration block:

dependencies {
    // Add your runtime dependencies using quark configuration
    quark("com.google.code.gson:gson:2.10.1")

    // you can use the dependency notation and exclude modules as you
    // would with other configurations
    quark("com.google.inject:guice:7.0.0") {
        exclude("com.google.guava", "guava")
    }
}

After adding your dependencies, you need to configure the Quark-J8 extension, by specifying the platform and other settings:

quark {
    // Specify the platform that will be used in your project (bukkit, paper, velocity, bungee or sponge)
    platform = "your-platform"

    // repositories to fetch dependencies from
    //
    // by default: includes maven central mirror
    repositories {
        // example repository
        maven("https://jitpack.io/")

        // optional: use all repositories declared in this
        // file if you don't want to re-include everything here
        includeProjectRepositories()
    }

    // relocate libraries here
    // com.google.code.gson --> org.bxteam.deps.gson
    relocate("com.google.code.gson", "org.bxteam.deps.gson")
}

Then, in your plugin, use the library manager with Gradle integration:

public class YourPlugin extends JavaPlugin {
    private BukkitLibraryManager libraryManager; // Replace with your library manager (BungeeCord, Sponge, etc.)

    @Override
    public void onLoad() {
        libraryManager = new BukkitLibraryManager(this); // Replace with your library manager (BungeeCord, Sponge, etc.)
        libraryManager.loadFromGradle();
    }
}

Finally, build with shadowJar:

./gradlew shadowJar

If you don’t want to use the Gradle plugin, you can still use Quark-J8 by manually adding the dependencies to your project.

To use Quark-J8 you need to add Maven Central Repository to your repositories and Quark-J8 to your dependencies in your project.

Depending on the build system you are using, add the following code to your project:

mavenCentral()
implementation("org.vaelow233.quark:{platform}:1.3.0")

Quark-J8 provides platform-specific library managers that handle dependency loading for different Minecraft server platforms. Each platform has its own manager class that you’ll need to initialize in your plugin.

public class BukkitTestPlugin extends JavaPlugin {
    private BukkitLibraryManager libraryManager;

    @Override
    public void onLoad() {
        libraryManager = new BukkitLibraryManager(this);
        libraryManager.addGoogleMavenCentralMirror();

        libraryManager.loadDependency("com.google.code.gson", "gson", "2.10.1");
    }
}

If you want to learn more, you can read next pages with advanced usage instructions.