apache / apache/maven-dependency-plugin

[MDEP-807] Exclude listed runtime scoped dependencies from dependency analysis

Open
#1,308 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Francis](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER289535)** opened **[MDEP-807](https://issues.apache.org/jira/browse/MDEP-807?redirect=false)** and commented

On our project we have a list of inhouse authored dependencies that we do expect to have runtime scope, these are our optional modules. This list of optional modules is subset of the entire list of inhouse authored dependencies.

We can add these optional, runtime scope expected dependencies to `ignoredUnusedDeclaredDependencies` but that will remove these dependencies from all the analysis. This presents a problem because we would like an unnecessary compile scope dependencies to be flagged in chains of these optional modules.

Alternatively we can make use of `ignoreUnusedRuntime` but we only expect these optional modules to have runtime scope, where a non-optional module is declared with a runtime dependency this should also flagged by the plugin.

Ideally it would be possible to specify which modules we do expect to have runtime scope. Couple of implementation approaches spring to mind:

### Approach 1

Extend the specification of `ignoredUnusedDeclaredDependencies` to include scope. So the syntax filter is extended from:

`[groupId]:[artifactId]:[type]:[version]`

to:

`[groupId]:[artifactId]:[type]:[version]:[scope]`

### Approach 2

Introduce a new parameter `ignoreUnusedRuntimeDependencies` (analogous to `ignoredNonTestScopedDependencies`)

---

**Affects:** 3.3.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing ignoredUnusedDeclaredDependencies and ignoredNonTestScopedDependencies parameters and how dependency scopes are analyzed. Confirm with maintainers whether scoped matching or a new ignoreUnusedRuntimeDependencies parameter is preferred; done means the selected configuration excludes only the intended runtime-scoped optional modules while still flagging other inappropriate runtime dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.