This guide explains how to reference the Medieval Factions plugin JAR in your Maven or Gradle project.
Upon each release (including draft releases), a GitHub Action automatically builds the plugin JAR and publishes it to GitHub Packages. This allows developers to extend the plugin by referencing it in their build files.
Add the GitHub Packages repository and the dependency to your build.gradle:
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Dans-Plugins/Medieval-Factions")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
}
dependencies {
implementation 'com.dansplugins:medieval-factions:VERSION:all'
}Add the GitHub Packages repository to your pom.xml:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/Dans-Plugins/Medieval-Factions</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.dansplugins</groupId>
<artifactId>medieval-factions</artifactId>
<version>VERSION</version>
<classifier>all</classifier>
</dependency>
</dependencies>To access GitHub Packages, you need to authenticate with a GitHub token.
Create a gradle.properties file in your project root or in ~/.gradle/gradle.properties:
gpr.user=YOUR_GITHUB_USERNAME
gpr.token=YOUR_GITHUB_TOKENOr set environment variables:
export GITHUB_ACTOR=YOUR_GITHUB_USERNAME
export GITHUB_TOKEN=YOUR_GITHUB_TOKENAdd your GitHub credentials to ~/.m2/settings.xml:
<settings>
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_TOKEN</password>
</server>
</servers>
</settings>- Go to GitHub Settings → Developer settings → Personal access tokens
- Generate a new token with
read:packagesscope - Use this token as your password/token in the configuration above
- Replace
VERSIONwith the specific version you want to use (e.g.,5.7.0-alpha-1) - The token must have at least
read:packagespermission - For CI/CD environments, use the
GITHUB_TOKENsecret which is automatically provided - The published artifact is the shadowJar with all dependencies included:
medieval-factions-{version}-all.jar