Skip to content

feat: per-module CHANGELOG.md support - #181

Open
AnteLund wants to merge 3 commits into
mainfrom
feature/per-module-changelog
Open

feat: per-module CHANGELOG.md support#181
AnteLund wants to merge 3 commits into
mainfrom
feature/per-module-changelog

Conversation

@AnteLund

@AnteLund AnteLund commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new changelog: "module" option to .changeset/config.json so that, with independent versioning, each bumped submodule gets its own CHANGELOG.md next to its pom.xml instead of one aggregated file at the reactor root.

  • New ChangelogMode.MODULE enum value on ChangesetsConfig, with validation that rejects it when combined with fixed versioning (all modules would share one version anyway).

  • PrepareMojo.writeChangelog branches on the mode: in MODULE mode it writes one file per bumped module.

  • When a BOM is also configured, the reactor-root CHANGELOG.md is additionally written as a dependabot-style rollup — one nested entry per bumped module under a single consumer-parent@<bomVersion> header — so consumers still get an at-a-glance overview of what moved in that BOM release while the authoritative per-module history lives next to each module.

  • Behavior is unchanged when changelog is absent (defaults to root); existing repos need no config edit.

  • Documentation

  • Unit- and Integration test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for per-module changelog generation in independent-versioned multi-module Maven projects by introducing a new changelog: "module" configuration mode, with BOM-aware rollup behavior preserved via an additional root changelog when applicable.

Changes:

  • Introduces ChangesetsConfig.ChangelogMode.MODULE and validates it against fixed versioning.
  • Updates PrepareMojo to write one CHANGELOG.md per bumped module in MODULE mode, plus an optional BOM rollup at the reactor root.
  • Adds documentation and new integration tests covering module and module+ BOM scenarios.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents changelog: "module" behavior and configuration reference updates.
changesets-maven-plugin/src/main/java/se/fortnox/changesets/maven/PrepareMojo.java Branches changelog writing to per-module mode; keeps BOM rollup behavior.
changesets-maven-plugin/src/it/module-changelog/verify.groovy IT verification for per-module changelog output (no BOM).
changesets-maven-plugin/src/it/module-changelog/pom.xml New IT project for module changelog scenario.
changesets-maven-plugin/src/it/module-changelog/module-a/pom.xml IT module A setup.
changesets-maven-plugin/src/it/module-changelog/module-a/EXPECTED_CHANGELOG.md Expected per-module changelog for module A.
changesets-maven-plugin/src/it/module-changelog/module-b/pom.xml IT module B setup.
changesets-maven-plugin/src/it/module-changelog/module-b/EXPECTED_CHANGELOG.md Expected per-module changelog for module B.
changesets-maven-plugin/src/it/module-changelog/invoker.properties Maven Invoker configuration for the new IT.
changesets-maven-plugin/src/it/module-changelog/.changeset/config.json IT config enabling independent + module changelog mode.
changesets-maven-plugin/src/it/module-changelog/.changeset/bump-a.md IT changeset for module A bump.
changesets-maven-plugin/src/it/module-changelog/.changeset/bump-b.md IT changeset for module B bump.
changesets-maven-plugin/src/it/module-changelog-bom/verify.groovy IT verification for per-module changelog output with BOM rollup.
changesets-maven-plugin/src/it/module-changelog-bom/pom.xml New IT project for module changelog + BOM scenario.
changesets-maven-plugin/src/it/module-changelog-bom/invoker.properties Maven Invoker configuration for the BOM IT.
changesets-maven-plugin/src/it/module-changelog-bom/EXPECTED_CHANGELOG.md Expected root rollup changelog for BOM scenario.
changesets-maven-plugin/src/it/module-changelog-bom/consumer-parent/pom.xml IT consumer-parent module for BOM header behavior.
changesets-maven-plugin/src/it/module-changelog-bom/bom/pom.xml IT BOM module with pinned properties for starters.
changesets-maven-plugin/src/it/module-changelog-bom/starter-a/pom.xml IT starter A setup.
changesets-maven-plugin/src/it/module-changelog-bom/starter-a/EXPECTED_CHANGELOG.md Expected per-module changelog for starter A.
changesets-maven-plugin/src/it/module-changelog-bom/starter-b/pom.xml IT starter B setup.
changesets-maven-plugin/src/it/module-changelog-bom/starter-b/EXPECTED_CHANGELOG.md Expected per-module changelog for starter B.
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/config.json IT config enabling BOM + per-module changelog mode.
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/bump-a.md IT changeset for starter A bump.
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/bump-b.md IT changeset for starter B bump.
changesets-java/src/test/java/se/fortnox/changesets/ChangesetsConfigTest.java Unit tests for parsing/validating module changelog mode.
changesets-java/src/main/java/se/fortnox/changesets/ChangesetsConfig.java Adds ChangelogMode.MODULE and validation against FIXED.
.changeset/swift-modules-changelog.md Changeset documenting the feature addition.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md
Comment on lines +103 to +107
- No reactor-root `CHANGELOG.md` is written. Any existing root `CHANGELOG.md` is left untouched.
- If a [BOM](#bom-bill-of-materials-support) is also configured, the reactor-root `CHANGELOG.md` is *additionally* written as
a rollup summary — one entry per bumped module under a single `consumer-parent@<bomVersion>` header, with each module's
changes nested below — so consumers see a dependabot-style overview of what moved in that BOM release while the
authoritative per-module history lives next to each module.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnteLund should we apply the suggestion?

@AnteLund

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: AnteLund <3100297+AnteLund@users.noreply.github.com>

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict in README.md (commit 27807c4). The conflict was in the ### Flow section — I kept the more detailed flow description from main (including the mvn changesets:prepare + mvn release:prepare release:perform snippet) while preserving the Configuration reference table added by this branch.

Comment thread README.md
release-plugin), omit `useReleasePluginIntegration`. The trade-off is an extra "chore: prepare release" commit
before `release:prepare` runs. No newline at end of file
before `release:prepare` runs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

This header seems to have been mistakenly added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants