Skip to content

[maven-3.10.x] Let plugins use MessageBuilderFactory with colours - #13918

Closed
slachiewicz wants to merge 1 commit into
apache:maven-3.10.xfrom
slachiewicz:message-api-for-plugins
Closed

slachiewicz wants to merge 1 commit into
apache:maven-3.10.xfrom
slachiewicz:message-api-for-plugins

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Plugins could not use the MessageBuilderFactory Maven 3.10 introduced, and when Maven injected it the result never had colours.

  • Core exports org.apache.maven.*, and classworlds matches a .* entry for that exact package only, so org.apache.maven.message was not visible to plugins: a mojo injecting org.apache.maven.message.MessageBuilderFactory fails on 3.10.0 with NoClassDefFoundError. Core now also exports org.apache.maven.message.*; org.apache.maven.message.internal stays private.
  • JLineMessageBuilderFactory was in no Sisu index, so every injection got DefaultMessageBuilderFactory, which never colours. maven-jline now generates its index, and its @Priority(10) factory wins.

Behaviour change: Maven's own messages built through the injected factory (MojoExecutor, LifecycleDependencyResolver, DeprecatedPluginValidator, DefaultMojoExecutionConfigurator, LifecycleExecutionException) are now coloured on a terminal, like the rest of the output; with -B, -l, --color=never or piped output they stay plain.

Verified: mvn verify -pl maven-jline,maven-core,maven-embedder → 10, 429 and 55 tests pass; a mojo injecting the 3.10 factory gets JLineMessageBuilderFactory on the built distribution, with colours under --color=always and a pseudo-terminal and none when piped or with --color=never.

Part of #13917.

Plugins could not load org.apache.maven.message: the core export
org.apache.maven.* matches only that package itself, not its
subpackages. And JLineMessageBuilderFactory was in no Sisu index, so
everything that injected a MessageBuilderFactory got the uncoloured
default.
@slachiewicz slachiewicz added this to the 3.10.1 milestone Nov 9, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review November 9, 2026 15:35
@slachiewicz

Copy link
Copy Markdown
Member Author

Folded into #13919: instead of exporting org.apache.maven.message, that PR replaces the 3.10 types with the Maven 4 org.apache.maven.api.services ones and keeps the maven-jline Sisu index from here.

@slachiewicz slachiewicz closed this Nov 9, 2026
@slachiewicz
slachiewicz deleted the message-api-for-plugins branch November 11, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mvn3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants