Skip to content

Switch default resolver transport from JDK/methanol to Apache HttpClient#12338

Merged
gnodet merged 3 commits into
apache:masterfrom
gnodet:default-apache-transport
Jun 22, 2026
Merged

Switch default resolver transport from JDK/methanol to Apache HttpClient#12338
gnodet merged 3 commits into
apache:masterfrom
gnodet:default-apache-transport

Conversation

@gnodet

@gnodet gnodet commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The JDK HTTP transport (backed by methanol) has proven flaky on Windows CI with race conditions in the gzip/inflater code path (NullPointerException: Inflater has been closed)
  • Remove maven-resolver-transport-jdk from the distribution entirely, making Apache HttpClient the only bundled HTTP transport
  • Users who need JDK transport can still add the dependency manually to their extension classpath

Changes

  • apache-maven/pom.xml: removed maven-resolver-transport-jdk dependency from the distribution; updated comment on transport-apache to reflect it is now the default
  • impl/maven-cli/pom.xml: switched mvnup dependency from transport-jdk to transport-apache
  • AbstractUpgradeStrategy (mvnup): switched DI provider from JdkTransporterFactory to ApacheTransporterFactory
  • MavenITmng7470ResolverTransportTest: default transport test now expects ApacheTransporter log snippet; removed testResolverTransportJdk test (JDK transport no longer shipped)

Notes

  • DefaultRepositorySystemSessionFactory is not changed — the "default" transport mode still falls through to auto, which selects the highest-priority available transport. Since transport-jdk is no longer on the classpath, auto now resolves to Apache HttpClient.
  • -Dmaven.resolver.transport=jdk will fail at runtime since the transport is no longer bundled.

Test plan

  • MavenITmng7470ResolverTransportTest — default transport now logs ApacheTransporter
  • Full CI run on all platforms

🤖 Generated with Claude Code

The JDK HTTP transport (backed by methanol) has proven flaky on
Windows CI due to race conditions in the gzip/inflater code path.
Switch the default transport to Apache HttpClient for better stability
while keeping JDK transport available via -Dmaven.resolver.transport=jdk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cstamas

cstamas commented Jun 22, 2026

Copy link
Copy Markdown
Member

@gnodet bundle re-declares it, so it needs to be removed as well
https://github.com/apache/maven/blob/master/apache-maven/pom.xml#L99-L103

@gnodet gnodet requested a review from cstamas June 22, 2026 14:43
Per review feedback: remove maven-resolver-transport-jdk from
apache-maven/pom.xml entirely so it is no longer shipped. Also
remove the testResolverTransportJdk integration test since the
JAR is no longer bundled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-6 milestone Jun 22, 2026
mergedProps.getOrDefault(Constants.MAVEN_RESOLVER_TRANSPORT, MAVEN_RESOLVER_TRANSPORT_DEFAULT);
if (MAVEN_RESOLVER_TRANSPORT_DEFAULT.equals(transport)) {
// The "default" mode (user did not set anything) from now on defaults to AUTO
// Default transport is Apache HTTP client; JDK transport available via -Dmaven.resolver.transport=jdk

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is wrong. You just removed jdk transport, so it is not available via....

request.setLocalRepository(getLocalRepository());

// native
// default (no property set) should select Apache

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to do anything, JDK is not on classpath, hence apache is default.

Since JDK transport is no longer bundled, the auto selection
naturally picks Apache as the highest-priority remaining transport.
No need to explicitly force priorities in the default case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added mvn4 enhancement New feature or request labels Jun 22, 2026
@gnodet gnodet merged commit ffd7baa into apache:master Jun 22, 2026
41 of 42 checks passed
gnodet added a commit that referenced this pull request Jun 23, 2026
…ent (#12338) (#12341)

* Switch default resolver transport from JDK/methanol to Apache HttpClient

The JDK HTTP transport (backed by methanol) has proven flaky on
Windows CI due to race conditions in the gzip/inflater code path.
Switch the default transport to Apache HttpClient for better stability
while keeping JDK transport available via -Dmaven.resolver.transport=jdk.


* Remove JDK/methanol transport from the distribution bundle

Per review feedback: remove maven-resolver-transport-jdk from
apache-maven/pom.xml entirely so it is no longer shipped. Also
remove the testResolverTransportJdk integration test since the
JAR is no longer bundled.


* Revert unnecessary priority overrides — auto selection suffices

Since JDK transport is no longer bundled, the auto selection
naturally picks Apache as the highest-priority remaining transport.
No need to explicitly force priorities in the default case.



---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mvn4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants