Skip to content

Remove use of deprecated MessageUtils - #264

Merged
elharo merged 1 commit into
masterfrom
fix-messageutils-deprecation
Sep 29, 2026
Merged

elharo merged 1 commit into
masterfrom
fix-messageutils-deprecation

Conversation

@elharo

@elharo elharo commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #262, which bumped maven-shared-utils from 3.4.2 to 3.5.0. That release deprecates org.apache.maven.shared.utils.logging.MessageUtils, so the build now warns at every call site.

Why not switch to MessageBuilderFactory?

3.5.0's deprecation notice points at org.apache.maven.message.MessageBuilderFactory, but that API only exists in Maven 3.10.0+, and the org.apache.maven.api.services variant only in Maven 4. This plugin's prerequisite is still Maven 3.6.3, so adopting either one means a prerequisite bump (or reflection) purely to keep a cosmetic feature. MessageBuilder is itself deprecated in the same release, so it isn't a way out either.

So: drop the styling instead of raising prerequisites.

What changed

describe-build-output and compare now emit plain text. maven-shared-utils had no other use in the plugin — the pom even said <!-- ONLY: MessageUtil --> — so the dependency is dropped as well, taking its transitive Jansi chain with it.

Verification

  • With -Dstyle.color=never the output is byte-for-byte identical to before. I diffed old vs. new for:
    • describe-build-output, including the header line, the :classifier:extension column, the target/ path prefix, and the repository-filename column;
    • the compare summary line, in both its all-matching (N files match) and failing (N files match, N differ) forms;
    • the compare mismatch line (... mismatch <file>: investigate with diffoscope ...).
  • With -Dstyle.color=always the only difference is the plugin's own escape sequences disappearing, which is the point. Maven's own [INFO]/[ERROR] prefix coloring is unchanged.
  • Generated .buildinfo and .buildcompare files are unaffected (they were never styled).
  • mvn clean verify -Prun-its: BUILD SUCCESS, 0 Checkstyle violations, 16/16 ITs pass, no dependency:analyze problems.

The only remaining deprecation warnings are the two @Component ones in ReproducibleCentralReport, which are fixed by #261 and are not on master yet.

maven-shared-utils 3.5.0 deprecates org.apache.maven.shared.utils.logging
MessageUtils, which now warns at every call site.

The suggested replacement is Maven's MessageBuilderFactory, but that
requires Maven 3.10.0 (or the org.apache.maven.api.services variant from
Maven 4) while this plugin's prerequisite is still Maven 3.6.3, and
MessageBuilder itself is deprecated in the same release. So rather than
raise prerequisites for a cosmetic feature, drop the styling: the affected
messages are now plain text.

The messages themselves are unchanged. With style.color=never the output is
byte-for-byte identical to before, verified for describe-build-output and
for the compare summary and mismatch lines; the .buildinfo/.buildcompare
files were never affected. The only difference is that the plugin no longer
emits ANSI escape sequences of its own -- Maven's own [INFO]/[ERROR] prefix
coloring is untouched.

With maven-shared-utils now unused, drop the dependency too, along with
its comment noting it existed only for MessageUtils.
@elharo
elharo requested review from cstamas and a lite review from Copilot September 28, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

What changed in this PR

Removes deprecated MessageUtils usage while preserving plain-text output and drops the now-unused maven-shared-utils dependency.

Changes:

  • Replaces styled output with plain text in both Mojos.
  • Removes the unused dependency from pom.xml.
File Description
src/​main/​java/​org/​apache/​maven/​plugins/​artifact/​buildinfo/​DescribeBuildOutputMojo.java Updated as part of this pull request.
src/​main/​java/​org/​apache/​maven/​plugins/​artifact/​buildinfo/​CompareMojo.java Updated as part of this pull request.
pom.xml Updated as part of this pull request.

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

@elharo
elharo merged commit 2600165 into master Sep 29, 2026
23 checks passed
@elharo
elharo deleted the fix-messageutils-deprecation branch September 29, 2026 10:50
@github-actions

Copy link
Copy Markdown

@elharo Please assign appropriate label to PR according to the type of change.

@github-actions github-actions Bot added this to the 3.7.0 milestone Sep 29, 2026
@hboutemy

hboutemy commented Oct 5, 2026

Copy link
Copy Markdown
Member

no, no, no
don't drop styling: I'm using this plugin, styling feature is useful

Maven is going in the wrong direction, I don't have time to fight everywhere

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants