There are 2 plugins that make up this project.
This needs to be applied only to the root project.
plugins {
id("com.github.rahulsom.waena.root").version("<VERSION>")
}
allprojects {
group = "TODO"
}
contacts {
validateEmails = true
addPerson("todo@noreply.github.com") {
moniker("To Do")
roles("owner")
github("https://github.com/todo")
}
}This needs to be applied to each module in the project that needs to be published.
plugins {
id("com.github.rahulsom.waena.published").version("<VERSION>")
}
description = "TODO"
// Optional — customize license and publish targets
waena {
license.set(WaenaExtension.License.Apache2)
// Publish to Maven Central only (default)
publishModes.set(setOf(WaenaExtension.PublishMode.Central))
// Or publish to both Maven Central and GitHub Packages
// publishModes.set(setOf(WaenaExtension.PublishMode.Central, WaenaExtension.PublishMode.GitHub))
}Set these 4 environment variables for publishing to Maven Central:
export ORG_GRADLE_PROJECT_sonatypeUsername=???
export ORG_GRADLE_PROJECT_sonatypePassword=???
export ORG_GRADLE_PROJECT_signingKey=???
export ORG_GRADLE_PROJECT_signingPassword=???GitHub Packages uses the GITHUB_ACTOR and GITHUB_TOKEN environment variables, which are
automatically provided in GitHub Actions.
For local publishing, set them explicitly:
export GITHUB_ACTOR=<your-github-username>
export GITHUB_TOKEN=<a-personal-access-token-with-write:packages-scope>Alternatively, you can set them as Gradle project properties:
export ORG_GRADLE_PROJECT_githubPackagesUsername=???
export ORG_GRADLE_PROJECT_githubPackagesPassword=???When publishing to GitHub Packages from a GitHub Actions workflow, the job needs packages: write:
jobs:
build:
permissions:
packages: writeIf you use a reusable workflow, the permission must be declared in that workflow’s jobs.<job>.permissions block —
permissions in the calling workflow do not grant additional permissions to the reusable workflow.
Waena does not configure remote Sonatype/JReleaser publishing in included/composite builds by default.
For standalone builds, it configures remote publishing only when a publishing-related task is requested
(snapshot, candidate, final, tasks containing publish, release, sonatype, or jreleaser).
This keeps regular build/test runs and composite builds from eagerly creating remote publishing repositories.
You can override this behavior with a project property:
# Force-enable remote publishing setup
./gradlew -PwaenaConfigureRemotePublishing=true test
# Force-disable remote publishing setup
./gradlew -PwaenaConfigureRemotePublishing=false final./gradlew snapshotSnapshots are published to Sonatype snapshots when Central is in publishModes.
GitHub Packages does not receive snapshots — only candidates and finals are published there.
Under the hood, this uses several other plugins and ties them all together such that you can release to maven central easily