Skip to content

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Feb 11, 2026

And as Plexus DI is capable only of field injection, and 2.0 of SecDispatcher contains final field as it was converted to JSR330, it causes WARNINGs on Java 26 due JEP 500.

Fix: drop component from Plexus XML (this was our last managed Plexus component) and provide a drop in replacement, a provider w/ name "maven".

And as Plexus DI is capable only of field injection, and
2.0 of SecDispatcher contains `final` field as it was
converted to JSR330, it causes WARNINGs on Java 26
due JEP 500.

Fix: drop component from Plexus XML (this was our last managed
Plexus component) and provide a drop in replacement, a
supplier w/ name "maven".
@cstamas cstamas added this to the 3.9.13 milestone Feb 11, 2026
@cstamas cstamas self-assigned this Feb 11, 2026
@cstamas cstamas added the bug Something isn't working label Feb 11, 2026
@cstamas
Copy link
Member Author

cstamas commented Feb 11, 2026

Current maven-3.9.x built maven emits warning:
https://gist.github.com/cstamas/b3b8efb6b8a80d253b0b3b54dcf38415

This PR makes maven-3.9.x built maven not warn anymore:
https://gist.github.com/cstamas/a1891b040020dd8d46399b2d3ad3063b

@cstamas cstamas marked this pull request as ready for review February 11, 2026 13:51
public SecDispatcherProvider(
PlexusCipher plexusCipher,
Map<String, PasswordDecryptor> decryptors,
@Named("${maven.settings.security.configurationFile:-~/.m2/settings-security.xml}")
Copy link
Member

@gastaldi gastaldi Feb 11, 2026

Choose a reason for hiding this comment

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

Is the - before ~/.m2/settings-security.xml intentional? Just out of curiosity

Copy link
Member Author

@cstamas cstamas Feb 11, 2026

Choose a reason for hiding this comment

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

Copy link
Member Author

@cstamas cstamas Feb 11, 2026

Choose a reason for hiding this comment

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

AFAIR, origin was bash https://linux.die.net/man/1/bash
Was long time ago 😄

${parameter:-word}
  Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;

/**
* Provides Maven own security dispatcher. It is configured slightly differently than the default one, as
Copy link
Contributor

Choose a reason for hiding this comment

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

"Maven own security dispatcher" is unclear. Consider rewriting

Copy link
Member Author

@cstamas cstamas Feb 11, 2026

Choose a reason for hiding this comment

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

It refers to the fact that managed component is not named "default", as it is almost always the case, but is named "maven". Hence "maven own" component. Am fine to reformulate this in whatever way you want.

The (somewhat confusing) fact is that plexus-sec-dispatcher.jar itself carries a "default" version of SecDispatcher component (and is named "default"), as it contains Sisu index file, so is discovered and on request created and injected, but it is not configured in the proper way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reformulated javadoc, to something hopefully better.

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;

/**
* Provides "maven" named security dispatcher, used by Maven. This component is configured slightly differently than the
Copy link
Contributor

Choose a reason for hiding this comment

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

Provides a security dispatcher named "maven". Maven uses this security dispatcher instead of the default. The default security dispatcher is unaware of Maven specific configuration file locations and should not be used...

@kwin
Copy link
Member

kwin commented Feb 11, 2026

But why not cherry-picking what we have in 4.x: compat/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/MavenSecDispatcher.java

@cstamas
Copy link
Member Author

cstamas commented Feb 11, 2026

But why not cherry-picking what we have in 4.x: compat/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/MavenSecDispatcher.java

cherry-pick? you mean copy/pasta, no? also, you imply we need to "pull" sec dispatcher 4.1.0 to Maven 3?

@cstamas cstamas merged commit dea5f14 into apache:maven-3.9.x Feb 12, 2026
18 checks passed
@cstamas cstamas deleted the maven-3.9.x-sec-dispatcher-warning branch February 12, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants