Installation
Configure repositories, Gradle plugins, protocol support, and the live-test source set.
Apply Anvil to the Gradle project that will contain your scenarios and journeys. This can be an existing plugin project or a dedicated Java test project. The setup below supplies JUnit, the built-in capabilities, Paper support, and the MCProtocolLib protocol library used by the first test.
Configure repositories
Add these blocks to settings.gradle.kts. Keep any repositories your application already needs.
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://registry.whereareiam.me/maven/packages")
maven("https://repo.opencollab.dev/main/")
maven("https://repo.opencollab.dev/maven-snapshots/")
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
maven("https://registry.whereareiam.me/maven/packages")
maven("https://repo.opencollab.dev/main/")
maven("https://repo.opencollab.dev/maven-snapshots/")
}
}These examples use Anvil version 0.0.1. Use one available Anvil version consistently across the
framework, platform units, and capability units. For a locally published checkout, add mavenLocal()
to both repository lists and use that checkout's publication version. See
building and publication.
Configure the build
Use this in build.gradle.kts:
plugins {
java
id("me.whereareiam.anvil") version "0.0.1"
id("me.whereareiam.anvil.junit") version "0.0.1"
id("me.whereareiam.anvil.capability.default") version "0.0.1"
id("me.whereareiam.anvil.platform.paper") version "0.0.1"
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(21)
}
dependencies {
add("anvilRuntimeOnly", "me.whereareiam.anvil:protocol-mcprotocol:0.0.1")
}
anvil {
acceptEula()
engine {
protocolLibrary("mcprotocol")
}
}Calling acceptEula() records your acceptance of the Minecraft EULA.
Review it before using this configuration.
The standard Anvil plugin adds foreground scenarios and IDE discovery. The JUnit plugin adds
automated tests, and the explicitly selected default capability unit supplies the built-in capabilities. The Paper unit adds Paper provisioning and its platform agent. Add a protocol library to anvilRuntimeOnly when using simulated players; protocolLibrary("mcprotocol") makes MCProtocolLib the default for every player. See Versions and compatibility for the Minecraft versions it supports. Applying Anvil does not package your plugin into a server automatically;
register its built JAR as an asset when you are ready
to test its behavior.
Choose source locations
src/
├── main/ Your application or plugin
├── test/ Ordinary unit tests
└── anvil/
├── java/ Scenarios and live JUnit tests
└── resources/ Test resourcesRun ./gradlew tasks --group verification to confirm that anvilTest is available. This lists tasks
without starting a server. Then follow the first test.
Smaller installations
Use me.whereareiam.anvil.junit for the automated JUnit workflow or
me.whereareiam.anvil for foreground environments. For either entry point,
choose capability units explicitly and keep the
required platform providers and protocol library installed. The Gradle integration
lists the plugin and dependency choices.