Skip to content

javachanges Configuration Reference

1. Overview

This page is the configuration catalog for javachanges.

Use it when you need one place to look up:

  • changeset file structure
  • CLI flags that affect behavior
  • env/release.env.example variables
  • GitHub Actions and GitLab CI/CD variable mapping
  • publishing-related environment prerequisites

2. Configuration Surface Map

SurfaceWhere it livesTypical owner
Changeset files.changesets/*.mdContributors
CLI invocation flagscommand line / CI workflow YAMLMaintainers and CI authors
Release env templateenv/release.env.exampleMaintainers
Platform variables and secretsGitHub Actions / GitLab CI/CD settingsRepository admins
Maven publish credentialslocal env, CI secrets, generated settings.xmlRelease maintainers
Repository version modelMaven root pom.xml <revision> or Gradle gradle.properties versionMaintainers

3. Changeset File Configuration

javachanges now defaults to the official Changesets-style package map:

md
---
"javachanges": minor
---

Add GitHub Actions release automation.

Monorepo example:

md
---
"core": minor
"cli": patch
---

Improve CLI parsing and release planning.

Rules:

PartMeaning
frontmatter keyMaven artifactId or Gradle project name
frontmatter valuepatch, minor, or major
markdown bodyuser-facing summary and notes

3.2 .changesets/config.json / .changesets/config.jsonc

javachanges also supports a repository-level config file:

jsonc
{
  "baseBranch": "main",
  "releaseBranch": "changeset-release/main",
  "snapshotBranch": "snapshot",
  "snapshotVersionMode": "plain",
  "tagStrategy": "whole-repo"
}

Accepted forms:

  • .changesets/config.json
  • .changesets/config.jsonc
  • comments are allowed in either form through // and /* ... */

Supported fields:

FieldMeaningDefault
baseBranchDefault base branch for release-plan automationmain
releaseBranchDefault generated release branch namechangeset-release/<baseBranch>
snapshotBranchConventional branch used for snapshot publishingsnapshot
snapshotVersionModeSnapshot publish strategy: stamped or plainstamped
tagStrategyRelease tag strategy: whole-repo or per-modulewhole-repo

Current behavior:

  • GitLab release-plan defaults read baseBranch and releaseBranch from this file when CLI flags and CI variables are absent
  • GitLab tag creation reads baseBranch and releaseBranch from this file to avoid tagging from the release branch and other non-base branches
  • preflight and publish read snapshotBranch from this file and default to snapshot mode when the current CI branch matches it
  • preflight and publish also read snapshotVersionMode; CLI --snapshot-version-mode overrides the config file
  • when snapshotBranch matches and snapshotVersionMode is plain, GitLab snapshot-branch jobs can keep using publish --execute true without extra shell branching
  • plan, github-tag-from-plan, and gitlab-tag-from-plan read tagStrategy; per-module creates one artifactId/vX.Y.Z tag per affected module
  • GitHub Actions examples in this repository follow the same branch naming model
  • snapshotBranch is no longer documentation-only; GitLab snapshot publish flows consume it directly

3.3 Legacy compatibility

The older javachanges frontmatter is still accepted:

md
---
release: minor
type: ci
modules: javachanges
summary: automate javachanges self-release publishing via GitHub Actions
---

Compatibility status:

FieldStatus
releaseLegacy, still parsed
modulesLegacy, still parsed
summaryLegacy, still parsed
typeLegacy metadata, still parsed

Note: new files should use the official package-map format instead of the legacy fields above.

4. CLI Flags That Affect Configuration

4.1 add

FlagMeaningDefault
--summaryFirst line of the generated markdown bodyinteractive prompt if omitted
--releaseRelease type to write for each selected packageinteractive prompt if omitted
--modulesComma-separated Maven artifactIds, Gradle project names, or allall
--bodyExtra markdown body after the summaryempty
--typeLegacy metadata onlyomitted
--formatOutput format, text or jsontext
--no-interactiveFail instead of prompting when required input is missingfalse

4.2 plan

FlagMeaningDefault
--applyApply the calculated release plan and write filesfalse
--directoryTarget repository pathcurrent directory, resolved upward

4.3 preflight and publish

FlagMeaningDefault
--snapshotPublish the current snapshot versionfalse
--snapshot-version-modeSnapshot version strategy: stamped or plainconfig value, then stamped
--snapshot-build-stampExplicit snapshot publish stampauto-generated
--tagPublish a release tag like v1.2.3none
--moduleRestrict publish to one Maven artifactId or Gradle project nameall packages
--allow-dirtySkip dirty worktree protectionfalse
--executeRun the final publish command instead of only printing itfalse

GitLab CI defaults for these commands:

  • CI_COMMIT_TAG is used automatically as the publish tag when --tag is omitted
  • .changesets/config.json / .changesets/config.jsonc snapshotBranch is used automatically when --snapshot is omitted
  • .changesets/config.json / .changesets/config.jsonc snapshotVersionMode is used automatically when --snapshot-version-mode is omitted
  • this lets a GitLab job use publish --execute true directly for both tag and snapshot pipelines

4.4 GitLab release commands

CommandFlagDefault source
gitlab-release-plan--project-idCI_PROJECT_ID
gitlab-release-plan--target-branchCI_DEFAULT_BRANCH, then main
gitlab-release-plan--release-branch.changesets/config.* releaseBranch, then changeset-release/<target-branch>
gitlab-tag-from-plan--before-shaCI_COMMIT_BEFORE_SHA
gitlab-tag-from-plan--current-shaCI_COMMIT_SHA
gitlab-tag-from-planbranch guard.changesets/config.* baseBranch and releaseBranch
gitlab-release--tagCI_COMMIT_TAG
gitlab-release--project-idCI_PROJECT_ID
gitlab-release--gitlab-hostCI_SERVER_HOST
init-gitlab-cigenerated branch rules.changesets/config.* baseBranch and snapshotBranch

5. env/release.env.example

Current template:

VariableRequiredMeaning
MAVEN_RELEASE_REPOSITORY_URLYesMaven release repository URL
MAVEN_SNAPSHOT_REPOSITORY_URLYesMaven snapshot repository URL
MAVEN_RELEASE_REPOSITORY_IDYesRelease server id used in Maven settings
MAVEN_SNAPSHOT_REPOSITORY_IDYesSnapshot server id used in Maven settings
MAVEN_REPOSITORY_USERNAMEYes unless release/snapshot credentials are splitShared username fallback
MAVEN_REPOSITORY_PASSWORDYes unless release/snapshot credentials are splitShared password fallback
MAVEN_RELEASE_REPOSITORY_USERNAMENoExplicit release username override
MAVEN_RELEASE_REPOSITORY_PASSWORDNoExplicit release password override
MAVEN_SNAPSHOT_REPOSITORY_USERNAMENoExplicit snapshot username override
MAVEN_SNAPSHOT_REPOSITORY_PASSWORDNoExplicit snapshot password override
MAVEN_CENTRAL_USERNAMENoSonatype Central Portal token username fallback
MAVEN_CENTRAL_PASSWORDNoSonatype Central Portal token password fallback
JAVACHANGES_SNAPSHOT_BUILD_STAMPNoSnapshot publish stamp; defaults to UTC timestamp + git short sha when unset
GITLAB_RELEASE_TOKENNoOptional GitLab release token for some GitLab release scenarios

Resolution rules used by the code:

SettingFallback logic
Release username/passwordMAVEN_RELEASE_REPOSITORY_*, then MAVEN_CENTRAL_*, then shared MAVEN_REPOSITORY_*
Snapshot username/passwordMAVEN_SNAPSHOT_REPOSITORY_*, then MAVEN_CENTRAL_*, then shared MAVEN_REPOSITORY_*
Release server idMAVEN_RELEASE_REPOSITORY_ID, then maven-releases
Snapshot server idMAVEN_SNAPSHOT_REPOSITORY_ID, then maven-snapshots

When MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD are set, generated settings also include a central server entry for central-publishing-maven-plugin.

6. GitHub Actions Variable Mapping

These are treated as non-secret variables:

Name
MAVEN_RELEASE_REPOSITORY_URL
MAVEN_SNAPSHOT_REPOSITORY_URL
MAVEN_RELEASE_REPOSITORY_ID
MAVEN_SNAPSHOT_REPOSITORY_ID
Name
MAVEN_REPOSITORY_USERNAME
MAVEN_REPOSITORY_PASSWORD
MAVEN_CENTRAL_USERNAME
MAVEN_CENTRAL_PASSWORD
MAVEN_RELEASE_REPOSITORY_USERNAME
MAVEN_RELEASE_REPOSITORY_PASSWORD
MAVEN_SNAPSHOT_REPOSITORY_USERNAME
MAVEN_SNAPSHOT_REPOSITORY_PASSWORD

6.3 Repository-specific Maven Central signing secrets

The self-release workflow in this repository also requires:

SecretPurpose
MAVEN_GPG_PRIVATE_KEYASCII-armored private key
MAVEN_GPG_PASSPHRASEGPG key passphrase

7. GitLab CI/CD Variable Mapping

7.1 Variables synced from the env file

When sync-vars --platform gitlab is used, these values are written as GitLab variables:

NameSecretProtected
MAVEN_RELEASE_REPOSITORY_URLNoNo
MAVEN_SNAPSHOT_REPOSITORY_URLNoNo
MAVEN_RELEASE_REPOSITORY_IDNoNo
MAVEN_SNAPSHOT_REPOSITORY_IDNoNo
MAVEN_REPOSITORY_USERNAMEYesYes
MAVEN_REPOSITORY_PASSWORDYesYes
MAVEN_CENTRAL_USERNAMEYesYes
MAVEN_CENTRAL_PASSWORDYesYes
MAVEN_RELEASE_REPOSITORY_USERNAMEYesYes
MAVEN_RELEASE_REPOSITORY_PASSWORDYesYes
MAVEN_SNAPSHOT_REPOSITORY_USERNAMEYesYes
MAVEN_SNAPSHOT_REPOSITORY_PASSWORDYesYes
GITLAB_RELEASE_TOKENYesYes

Operational note:

  • doctor-platform --platform gitlab now checks both remote protected variables and the configured snapshotBranch
  • if protected variables exist but the snapshot branch is not protected, the command fails with a concrete remediation hint because GitLab will not expose protected variables to that branch

7.2 Extra GitLab CI runtime variables

These are expected by the GitLab release automation:

VariableSource
CI_PROJECT_IDGitLab built-in variable
CI_DEFAULT_BRANCHGitLab built-in variable
CI_SERVER_HOSTGitLab built-in variable
CI_SERVER_URLGitLab built-in variable
CI_PROJECT_PATHGitLab built-in variable
CI_COMMIT_BEFORE_SHAGitLab built-in variable
CI_COMMIT_SHAGitLab built-in variable
GITLAB_RELEASE_BOT_USERNAMEProject variable you provide
GITLAB_RELEASE_BOT_TOKENProject variable you provide

8. Repository Version And Publish Configuration

8.1 Repository version model

Recommended Maven root pom.xml pattern:

xml
<version>${revision}</version>

And the mutable version field:

xml
<revision>1.2.3-SNAPSHOT</revision>

Recommended Gradle gradle.properties pattern:

properties
version=1.2.3-SNAPSHOT

javachanges also accepts revision=1.2.3-SNAPSHOT in gradle.properties, but version is preferred for Gradle builds.

8.2 Local Maven repository override

publish and preflight recognize MAVEN_OPTS values like:

bash
export MAVEN_OPTS="-Dmaven.repo.local=.m2/repository"

Effect:

SettingResult
no MAVEN_OPTS overrideuses .m2/repository inside the target repo
relative maven.repo.localresolved relative to the target repo
absolute maven.repo.localused as-is

8.3 Snapshot version modes

javachanges supports two snapshot publish modes:

ModeBehavior
stampedrewrites 1.2.3-SNAPSHOT to a unique value like 1.2.3-20260420.154500.abc1234-SNAPSHOT before deploy
plainkeeps the effective Maven version at the original revision such as 1.2.3-SNAPSHOT

Important note:

  • plain mode preserves the Maven project version only
  • Maven or Nexus snapshot repositories still typically store expanded timestamped filenames for uploaded snapshot artifacts
  • that filename expansion is standard repository behavior, not an extra rewrite by javachanges

Gradle note:

  • preflight and publish are Maven-specific
  • Gradle builds should use manifest-field --field releaseVersion and run ./gradlew publish -Pversion=...
  • Gradle release planning still writes gradle.properties, CHANGELOG.md, and .changesets/release-plan.*

9.1 Single-module library

SurfaceRecommendation
Changeset fileone package key matching the root artifactId
--modulesomit it or use all
release taggingv1.2.3
publish targetall packages

9.2 Maven monorepo

SurfaceRecommendation
Changeset fileone frontmatter entry per affected artifactId
--modulespass explicit artifactIds during add
release taggingwhole-repo v1.2.3 unless you intentionally use module tags elsewhere
publish targetall packages, or one --module when needed

9.3 Gradle single-project or multi-project build

SurfaceRecommendation
Version filegradle.properties with version=...-SNAPSHOT
Project detectionsettings.gradle(.kts) include(...) entries
Changeset fileone frontmatter entry per affected Gradle project name
--modulespass project names such as core,api, or all
publish targetGradle publish tasks, using manifest fields as inputs

9.4 Why whole-repo tags are the default for Maven and Gradle monorepos

javachanges intentionally defaults to whole-repo tags such as v1.2.3 for Java monorepos.

Reasoning:

  • many Maven and Gradle monorepos publish a coordinated release train where multiple artifacts move to the same version together
  • the release PR, changelog, release notes, signing, and Maven Central deploy steps are commonly handled as one repository-level release operation
  • Java consumers often reason about compatibility as "this repository release" or "this platform version", not only as isolated package versions

This differs from the usual Changesets workflow in npm monorepos, where per-package tags such as pkg-a@1.2.3 are often more useful because packages are published and consumed independently.

In practice, the recommended mental model is:

  • use whole-repo tags like v1.2.3 when your Maven modules are versioned and released together
  • use module tags only when your repository deliberately treats modules as independently tagged release units

javachanges can still parse module tags like demo-app/v2.0.0 for downstream release and notes workflows, but release-plan automation creates a single whole-repo tag by default.

If you opt into per-module tagging:

  • plan --apply true still computes one shared releaseVersion
  • github-tag-from-plan and gitlab-tag-from-plan create one tag per affected module, such as core/v1.2.3
  • github-release-from-plan only works when the plan resolves to a single tag; for multi-module plans, use explicit tag-based release commands instead
NeedDocument
Command-by-command syntaxCLI Reference
Generated manifest filesRelease Plan Manifest
GitHub workflow patternsGitHub Actions Usage Guide
GitLab workflow patternsGitLab CI/CD Usage Guide
Maven Central self-release flowPublish To Maven Central

Released under the Apache-2.0 License.