Skip to content

Encapsulate deprecated MessageUtils usage in private methods - #463

Merged
slawekjaranowski merged 2 commits into
apache:masterfrom
slawekjaranowski:suppress-messageutils-deprecation
Nov 14, 2026
Merged

slawekjaranowski merged 2 commits into
apache:masterfrom
slawekjaranowski:suppress-messageutils-deprecation

Conversation

@slawekjaranowski

Copy link
Copy Markdown
Member

MessageUtils and MessageBuilder from maven-shared-utils are deprecated, which produced a number of deprecation warnings during the build.

Changes

  • DescribeMojo: added a private buffer() method wrapping MessageUtils.buffer(); all call sites use it now.
  • DescribeMojo: the two places that relied on the deprecated MessageBuilder.toString() through string concatenation now call build() explicitly.
  • EffectivePomMojo: moved the comment coloring logic into a private colorizeComments(String) method.
  • Both methods are annotated with @SuppressWarnings("deprecation") and refer to the deprecated classes by fully qualified name. The imports were removed, because a method-level suppression does not cover a deprecation warning reported on an import.

The build no longer reports deprecation warnings.

Future migration

The replacement is org.apache.maven.api.services.MessageBuilderFactory. apache/maven#13917 proposes to ship it in Maven 3.9 and 3.10 as well, so that one plugin binary can use it on 3.9, 3.10 and 4. It is already merged for 3.10.x (apache/maven#13919) but not yet available in 3.9. This plugin requires Maven 3.9.0, so following apache/maven-shared-utils#443 it keeps using MessageUtils for now. Once the prerequisite allows it, only the bodies of these two methods need to be replaced by an injected MessageBuilderFactory (builder() and isColorEnabled()).

🤖 Generated with Claude Code

…tils-deprecation

# Conflicts:
#	src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
@slawekjaranowski
slawekjaranowski merged commit 1e2c74c into apache:master Nov 14, 2026
14 checks passed
@slawekjaranowski
slawekjaranowski deleted the suppress-messageutils-deprecation branch November 14, 2026 13:32
@github-actions github-actions Bot added this to the 3.6.0 milestone Nov 14, 2026
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.

2 participants