apache / apache/maven

warn when encountering an obsolete/invalid dependency exclusion

Open
#12,428 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

### New feature, improvement proposal

currently it is possible to add any `groupId`/`artifactId` inside an `exclusion` for a given dependency.

However if that exclusion is not within the dependency chain of the specified dependency then no warning is emmited by maven.

Over time this can lead to accumulation of no longer needed exclusions. It would be useful if Maven emitted a log (warning?) about exclusions for a dependency that have no impact.

e.g. given the following `pom.xml`

```xml

4.0.0

test
test
1.0-SNAPSHOT



org.junit.jupiter
junit-jupiter-api
5.11.0


org.apache.continuum
continuum-core



```

running `mvn package -DskipTests` results in no warnings that the apache continuum exclusion is not needed.

it would be nice to have an entry like

`[WARNING] exclusion of org.apache.continuum:continuum-core for org.junit.jupiter:junit-jupiter-api in test:test is obsolete - there is no dependency on this exclusion`

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with the supplied pom.xml and `mvn package -DskipTests`, then trace Maven's dependency resolution and exclusion handling from that example. Done means an obsolete exclusion such as `org.apache.continuum:continuum-core` produces a warning identifying the exclusion and declaring that it has no impact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.