Skip to content

dependency:tree -Dscope filter is silently non-functional due to MSHARED-4 #1649

Description

@elharo

TreeMojo has a scope parameter (line 122) that is supposed to filter the dependency tree, but it has been non-functional for years due to MSHARED-4 in the maven-dependency-tree library. The TODO at line 232 documents this:

// TODO: note that filter does not get applied due to MSHARED-4
ArtifactFilter artifactFilter = createResolvingArtifactFilter();

The artifactFilter is passed to dependencyCollectorBuilder.collectDependencyGraph() and dependencyGraphBuilder.buildDependencyGraph() at lines 241 and 246, but these methods ignore the filter. This means:

mvn dependency:tree -Dscope=compile

still shows all scopes (test, provided, etc.) with no warning that the filter was not applied.

The fix would be to apply the filter client-side after obtaining the tree, or to fix MSHARED-4 in maven-dependency-tree, or at minimum to log a warning when a scope is specified that it may not be honored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions