Publishing
Library modules publish to GitHub Packages under names that never collide across plugins.
Your modules
Each module in publishedModules is published by ./gradlew publish with:
| Setting | Value | Example |
|---|---|---|
| Repository | GitHubPackages, https://maven.pkg.github.com/{gitOrgName}/{gitRepository} | https://maven.pkg.github.com/Example/example-plugin |
| Credentials | GITHUB_ACTOR and GITHUB_TOKEN environment variables | |
groupId | project-group | io.github.example |
artifactId | {rootProject.name}-{module} | example-plugin-api |
version | project-version | 1.0.0 |
POM <url> | pomUrl | https://github.com/Example/example-plugin |
POM <developers> | the developer* properties, when set |
The artifactId is qualified with the project name because every plugin in a group has an api module: bare module names would make two plugins publish the same io.github.example:api, and a consumer could not depend on both.
The artifactId and POM are set on every Maven publication of the module, including one the module declares itself, so a module's own pom { name = ... } is kept.
In CI
In GitHub Actions the workflow token can publish to the repository's own packages:
.github/workflows/publish.ymlpermissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 25
- run: ./gradlew publish
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Consuming a published module
Another plugin compiles against a published module without shading it, because the plugin that owns it is installed on the server:
build.gradlerepositories {
maven {
url = uri('https://maven.pkg.github.com/Example/example-plugin')
credentials {
username = System.getenv('GITHUB_ACTOR')
password = System.getenv('GITHUB_TOKEN')
}
}
}
dependencies {
compileOnly 'io.github.example:example-plugin-api:1.0.0'
}
The plugin itself
| Where | Coordinates |
|---|---|
| Gradle Plugin Portal | plugins { id 'io.github.mcengine.build-logic' version '0.2.0' } |
| GitHub Packages, the jar | io.github.mcengine:gradle-plugin:0.2.0 at https://maven.pkg.github.com/MCEngine/gradle-plugin |
| GitHub Packages, the plugin marker | io.github.mcengine.build-logic:io.github.mcengine.build-logic.gradle.plugin:0.2.0 |
The jar depends on com.gradleup.shadow:shadow-gradle-plugin:9.4.1, which is how Shadow reaches your build classpath.