Skip to content

How to use

Pedro Souza edited this page Oct 21, 2025 · 3 revisions

To add the repository to your project you will need a personal access token (classic) to access Github Maven Packages, see more at: Introduction to GitHub Packages.

My recommendation is to create a properties file in your development environment, and if you're using a CI/CD pipeline, use environment variables to authenticate with Github Packages. See:

build.gradle.kts (Kotlin DSL)

val localProperties = Properties()
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
    localProperties.load(localPropertiesFile.toPath().toAbsolutePath().inputStream())
}

repositories {
    //< other repositories... >
    maven("https://maven.pkg.github.com/morapowered/packages") {
        credentials {
            username = localProperties.getProperty("gpr.username") ?: System.getenv("GH_USERNAME")
            password = localProperties.getProperty("gpr.token") ?: System.getenv("GH_TOKEN")
        }
        content {
            // includeGroupByRegex("com.velocitypowered") -> If you use velocity-language-kotlin
            includeGroupByRegex("io.github.morapowered")
            includeGroupByRegex("io.github.morapowered.*")
        }
    }
}

build.gradle (Groovy)

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
    localPropertiesFile.withInputStream { localProperties.load(it) }
}

repositories {
    //< other repositories... >
     maven {
        url = "https://maven.pkg.github.com/morapowered/packages"
        credentials {
            username = localProperties.getProperty("gpr.username") ?: System.getenv("GH_USERNAME")
            password = localProperties.getProperty("gpr.token") ?: System.getenv("GH_TOKEN")
        }
        content {
            //includeGroupByRegex "com.velocitypowered"  -> If you use velocity-language-kotlin
            includeGroupByRegex "io.github.morapowered"
            includeGroupByRegex "io.github.morapowered.*"
        }
    }
}

local.properties

gpr.username=<your username here>
gpr.token=<your personal access token here>

Clone this wiki locally