Skip to content

Add exact dependency scope filters - #1827

Open
rohan4naik wants to merge 1 commit into
apache:masterfrom
rohan4naik:feature/declared-scope-filters-1821
Open

rohan4naik wants to merge 1 commit into
apache:masterfrom
rohan4naik:feature/declared-scope-filters-1821

Conversation

@rohan4naik

Copy link
Copy Markdown

includeScope/excludeScope select classpath thresholds, so they cannot express “all scopes except test.” Add includeDeclaredScopes and excludeDeclaredScopes for exact effective scopes in the dependency graph. They intersect the existing threshold filters, with exclusions applied after inclusions.

The new filter reuses AbstractArtifactFeatureFilter for exact matching, list handling and ordering, and the existing parameter-cleaning helper. Apply it in the shared dependency pipeline and go-offline's separate pipeline. This keeps existing threshold semantics and default behavior; the usage guide explains both forms.

Validation on Java 21 / Maven 3.10.1:

  • The new Invoker fixture fails on the original code because excludeDeclaredScopes=test still copies the test JAR. It now passes five configurations through both copy-dependencies and list, covering all five scopes, inclusion/exclusion combinations, thresholds and unchanged defaults.
  • Full unit suite: 777 tests, 0 failures/errors, 1 skipped. Tests also cover exact matching, whitespace normalization, filtering before artifact downloads and the separate go-offline path.
  • Full integration suite: all 121 builds pass. Checkstyle, RAT license checks and dependency analysis pass; spotless:apply and git diff --check are clean.

Fixes #1821. AI-assisted; the code and test results were reviewed.


To make clear that you license your contribution under the Apache License Version 2.0, check one of the following:

Copilot AI balanced review requested due to automatic review settings December 5, 2026 08:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter dependencies by their declared scope, to list or copy everything but test dependencies

2 participants