Skip to content

fix: default BF collector skipper to "versioned" to avoid dropping transitive deps (#14155) - #14172

Draft
gnodet wants to merge 1 commit into
apache:maven-4.0.xfrom
gnodet:fix/bf-skipper-default-4x
Draft

gnodet wants to merge 1 commit into
apache:maven-4.0.xfrom
gnodet:fix/bf-skipper-default-4x

Conversation

@gnodet

@gnodet gnodet commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Temporary workaround — must be reverted when upgrading to Resolver 2.0.27 (apache/maven-resolver#2368).
Once Resolver 2.0.27 is bundled, please open an issue to remove the putIfAbsent call and the BfDependencyCollector import added by this PR.

Summary

Workaround for #14155: transitive dependencies silently dropped when the BF dependency collector resolves a conflict in favour of a winner that was already visited without its children expanded.

Root Cause

The BF collector's default skipper mode (versionless) tracks visited nodes by G:A:C:E — no version. When a conflict selects a higher-version winner, but that exact G:A:C:E tuple was already visited at a lower version (without its children being expanded at that point), the collector skips the winner's subtree. Those transitive dependencies never reach the classpath, causing ClassNotFoundException at runtime.

The fix is in the Resolver: apache/maven-resolver#2368 changes DEFAULT_SKIPPER from versionless to versioned, so each G:A:C:E:V is treated as a distinct node. This will ship in Resolver 2.0.27.

Fix

In DefaultRepositorySystemSessionFactory.newRepositorySessionBuilder(), before the session config is assembled, Maven now injects aether.dependencyCollector.bf.skipper=versioned as a soft default via mergedProps.putIfAbsent(...). Because this runs before system/user properties override mergedProps, it behaves exactly like a "changed default":

  • All users are fixed transparently with no config change
  • -Daether.dependencyCollector.bf.skipper=versionless still overrides it for anyone who needs the old behaviour

Tests

Existing DefaultRepositorySystemSessionFactoryTest (16 tests) all pass.

Fixes #14155


Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet

@gnodet gnodet added the bug Something isn't working label Nov 28, 2026
@gnodet gnodet added this to the 4.0.0 milestone Nov 28, 2026
…ansitive deps (apache#14155)

The resolver's BF dependency collector uses a "versionless" skipper by
default (aether.dependencyCollector.bf.skipper=versionless), which tracks
visited nodes by G:A:C:E only (no version). When a conflict selects a winner
at a higher version that was already enqueued/visited without its children
being expanded (because the lower-version node was seen first), the children
are silently dropped, causing ClassNotFoundException at runtime.

The real fix is in the resolver (apache/maven-resolver#2368) which changes the
default to "versioned". As a temporary workaround, Maven now injects
"versioned" as the default for this property before the user/system/profile
properties are applied. Users who explicitly need "versionless" can still
override via -Daether.dependencyCollector.bf.skipper=versionless.

Fixes apache#14155
@gnodet
gnodet force-pushed the fix/bf-skipper-default-4x branch from 84b4baf to ca6f479 Compare November 28, 2026 18:34
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.

1 participant