| description | Copy-ready javachanges command sequences for common Maven and Gradle release planning, CI, and publishing workflows. |
|---|
This page is the practical companion to the CLI reference.
Use it when you do not want to piece together commands from multiple pages and instead want one copy-ready sequence for a common workflow.
The recipes below assume:
javachangesis run from source with Maven- your target repository has either a Maven
pom.xmlor a Gradlegradle.properties - Maven repositories use root
<revision>; Gradle repositories useversionorrevisioningradle.properties
Set a reusable repository path first:
export REPO=/path/to/your/repoThen reuse "$REPO" in the recipes below.
If you are testing against the checked-in sample repository:
export REPO=examples/basic-monorepoUse this when the repository publishes one Maven artifact from the root project.
mvn -q -DskipTests compile exec:java -Dexec.args="add --directory $REPO --summary 'fix release note rendering' --release patch"mvn -q -DskipTests compile exec:java -Dexec.args="status --directory $REPO"
mvn -q -DskipTests compile exec:java -Dexec.args="plan --directory $REPO"mvn -q -DskipTests compile exec:java -Dexec.args="plan --directory $REPO --apply true"mvn -q -DskipTests compile exec:java -Dexec.args="manifest-field --directory $REPO --field releaseVersion"Expected outputs after plan --apply true:
pom.xmlrevision advances to the next snapshotCHANGELOG.mdgets a new release section.changesets/release-plan.jsonis written.changesets/release-plan.mdis written
Use this when one repository contains multiple Maven modules and you want one reviewed release plan across them.
mvn -q -DskipTests compile exec:java -Dexec.args="add --directory $REPO --summary 'add release notes workflow' --release minor --modules core,api"mvn -q -DskipTests compile exec:java -Dexec.args="status --directory $REPO"Look for:
Affected packagesRelease type- the pending changeset filename and summary
mvn -q -DskipTests compile exec:java -Dexec.args="plan --directory $REPO --apply true"
mvn -q -DskipTests compile exec:java -Dexec.args="manifest-field --directory $REPO --field releaseLevel"mvn -q -DskipTests compile exec:java -Dexec.args="module-selector-args --directory $REPO --module core"That is useful when a downstream workflow needs Maven -pl arguments for one package.
Use this when you want to standardize repository publishing variables before enabling GitHub Actions or GitLab CI/CD.
mvn -q -DskipTests compile exec:java -Dexec.args="init-env --target env/release.env.local"mvn -q -DskipTests compile exec:java -Dexec.args="render-vars --directory $REPO --env-file env/release.env.local --platform github"mvn -q -DskipTests compile exec:java -Dexec.args="render-vars --directory $REPO --env-file env/release.env.local --platform gitlab"mvn -q -DskipTests compile exec:java -Dexec.args="doctor-local --directory $REPO --env-file env/release.env.local"Use doctor-platform after syncing real repository variables.
mvn -q -DskipTests compile exec:java -Dexec.args="render-vars --directory $REPO --env-file env/release.env.local --platform github --format json"
mvn -q -DskipTests compile exec:java -Dexec.args="doctor-local --directory $REPO --env-file env/release.env.local --format json"
mvn -q -DskipTests compile exec:java -Dexec.args="audit-vars --directory $REPO --env-file env/release.env.local --platform github --github-repo owner/repo --format json"Use these when a shell step needs structured diagnostics instead of parsing aligned terminal columns.
Use this when the target repository is a Gradle single-project or multi-project build.
# gradle.properties
version=1.1.0-SNAPSHOT// settings.gradle.kts
rootProject.name = "sample-gradle-library"
include(":core", ":api")mvn -q dependency:copy -Dartifact=io.github.sonofmagic:javachanges:__JAVACHANGES_LATEST_RELEASE_VERSION__ -DoutputDirectory=.javachanges
export JAVACHANGES="java -jar .javachanges/javachanges-__JAVACHANGES_LATEST_RELEASE_VERSION__.jar"$JAVACHANGES add --directory $REPO --summary "add retry metadata" --release minor --modules core,api
$JAVACHANGES status --directory $REPO
$JAVACHANGES plan --directory $REPO --apply trueExpected outputs after plan --apply true:
gradle.propertiesversion advances to the next snapshotCHANGELOG.mdgets a new release section.changesets/release-plan.jsonis written.changesets/release-plan.mdis written
$JAVACHANGES gradle-publish --directory $REPO --tag v1.2.3
$JAVACHANGES gradle-publish --directory $REPO --tag v1.2.3 --execute trueSee Gradle Usage Guide for the full Gradle workflow and limitations.
Use this when main accumulates .changesets/*.md files and a workflow should open one reviewed release PR.
mvn -q -DskipTests compile exec:java -Dexec.args="status --directory $REPO"
mvn -q -DskipTests compile exec:java -Dexec.args="plan --directory $REPO --apply true"mvn -q -DskipTests compile exec:java -Dexec.args="manifest-field --directory $REPO --field releaseVersion --fresh true"
# releaseLevel is available from the compatibility manifest when plan files were written.
mvn -q -DskipTests compile exec:java -Dexec.args="manifest-field --directory $REPO --field releaseLevel"Commit only these generated files:
pom.xml- or
gradle.properties CHANGELOG.md- generated release-plan files only when compatibility output is enabled
For a full workflow file, see GitHub Actions Usage Guide and Examples Guide.
Use this when GitLab should manage the release branch, merge request, and final tag from changesets.
mvn -q -DskipTests compile exec:java -Dexec.args="gitlab-release-plan --directory $REPO --project-id 12345 --write-plan-files false --execute true"mvn -q -DskipTests compile exec:java -Dexec.args="gitlab-tag-from-plan --directory $REPO --fresh true --before-sha <before-sha> --current-sha <current-sha> --execute true"Typical CI variable mapping:
| Input | Common source |
|---|---|
--project-id |
CI_PROJECT_ID |
--before-sha |
CI_COMMIT_BEFORE_SHA |
--current-sha |
CI_COMMIT_SHA |
For the full pipeline layout, see GitLab CI/CD Usage Guide.
Use this before enabling real publish execution.
This recipe is Maven-specific. For Gradle artifact publishing, use Gradle's publish task and consume the release-plan manifest as shown in Section 6.
mvn -q -DskipTests compile exec:java -Dexec.args="preflight --directory $REPO --snapshot"mvn -q -DskipTests compile exec:java -Dexec.args="preflight --directory $REPO --tag v1.2.3"mvn -q -DskipTests compile exec:java -Dexec.args="publish --directory $REPO --tag v1.2.3"Only add --execute true after the printed command, generated settings, and credentials all look correct.
This recipe is specific to the javachanges repository itself, not every downstream repository.
mvn -Pcentral-publish -Dgpg.skip=true verifymvn -Pcentral-publish clean deploypnpm snapshot:publish:localIf you only need the generic repository publish helper instead of Sonatype Central publishing, use the preflight and publish recipes above.
| Goal | Start here |
|---|---|
| One root artifact, local release plan | Section 3 |
| Monorepo package release planning | Section 4 |
| CI variable preparation | Section 5 |
| Gradle release planning | Section 6 |
| GitHub release PR automation | Section 7 |
| GitLab release MR and tag automation | Section 8 |
| Safe publish rehearsal | Section 8 |
| This repository's Central release | Section 9 |
| Need | Document |
|---|---|
| Full command catalog | CLI Reference |
| Maven command flow | Maven Usage Guide |
| Gradle command flow | Gradle Usage Guide |
| Example repository structure | Examples Guide |
| Variable catalog | Configuration Reference |
| Applied manifest fields | Release Plan Manifest |
| Failure diagnosis | Troubleshooting Guide |