apache / apache/maven

[MNG-7238] Dependency deprecation indicators

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

Description

**[Chris Kilding](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=5d7f15)** opened **[MNG-7238](https://issues.apache.org/jira/browse/MNG-7238?redirect=false)** and commented

I would like to propose a new Maven feature: dependency deprecation indicators.

In a nutshell, the idea is to let maintainers set a 'deprecated' metadata indicator on a Maven artifact in a repository. This will indicate to users that the artifact should no longer be used.

The Maven CLI tools could then react to deprecation indicators in the appropriate ways:
* `mvn` itself: Print a warning when deprecated dependencies are seen.
* Maven Enforcer Plugin: Add a `` rule which throws an error when deprecated dependencies are seen. (Also have a 'skip' property which allows the rule to be temporarily bypassed if needed.)
* Maven Dependency Tree: Print a `[deprecated]` notice next to any deprecated dependency in the tree.

We can also envisage automated agents like Dependabot or Snyk using these indicators to alert developers about deprecated dependencies in their stacks, and even assisting developers to remove them.

Some of the major build tools outside the JVM already have deprecation indicators:
* NPM: https://docs.npmjs.com/cli/v7/commands/npm-deprecate
* Nuget: https://docs.microsoft.com/en-us/nuget/nuget-org/deprecate-packages
* Composer: https://tomasvotruba.com/blog/2017/07/03/how-to-deprecate-php-package-without-leaving-anyone-behind/
* Cocoapods: https://guides.cocoapods.org/syntax/podspec.html#deprecated

So the feature has precedent, and I believe it would be useful to have in Maven.

This Jira ticket follows up from the conversation "Feature proposal: Dependency deprecation indicators" on the maven-dev mailing list.

---

**Sub-tasks:**
- [MNG-7239](https://issues.apache.org/jira/browse/MNG-7239) Show a [deprecated] indicator next to deprecated dependencies in maven-dependency-tree plugin

- [MNG-7240](https://issues.apache.org/jira/browse/MNG-7240) Add deprecation indicator property to Maven core

- [MNG-7241](https://issues.apache.org/jira/browse/MNG-7241) Add filter option to maven-dependency-tree that shows only deprecated dependencies (and their direct ancestors)

- [MNG-7242](https://issues.apache.org/jira/browse/MNG-7242) Warn the user about deprecated dependencies when Maven builds a project

- [MNG-7243](https://issues.apache.org/jira/browse/MNG-7243) Add Maven Enforcer Plugin rule that bans deprecated dependencies

**Remote Links:**
- [Detailed feature proposal document
](https://github.com/p4em/artifact-deprecation)
- [Automatic artifact deprecation proposal document
](https://github.com/p4em/automatic-artifact-deprecation)

0 votes, 6 watchers

Contributor guide

Open the contributing guide

Research direction

Start with the linked detailed feature proposal and the MNG-7239 through MNG-7243 sub-tasks to understand the intended scope and which Maven component each part targets. Check the related Maven core and dependency-tree entry points named by those sub-tasks, then confirm the design with the existing discussion. Done requires an agreed implementation plan spanning the relevant sub-tasks and corresponding tests.

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.