apache / apache/maven-enforcer

bannedDependencies.searchTransitive fails with "uses the deprecated Maven Enforcer Plugin API"

Open
#1,023 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
161
Forks
180
Avg merge
2d 4h
Merged PRs (30d)
11

Description

### Affected version

3.6.3

### Bug description

Using `searchTransitive` on the `bannedDependencies` rule (https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html) triggers

> ruleName searchTransitive with implementation org.apache.maven.plugins.enforcer.SearchTransitive uses the deprecated Maven Enforcer Plugin API. This will not be supported in a future version of the plugin. Please contact the rule maintainer to upgrade the rule implementation to the current API.

This is regardless of the specific value assigned to `searchTransitive`; the mere presence of the configuration item causes the problem.

If `true`, this will also abort the Maven build process, regardless of any other diagnostics.

This reproduces with Java 17 and Java 21 as the Java runtime.

To reproduce, run `mvn validate` on the attached trivial `pom.xml`

[pom.xml](https://github.com/user-attachments/files/31946527/pom.xml)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running mvn validate with the attached pom.xml using Java 17 or 21, focusing on the bannedDependencies rule and its searchTransitive configuration. Trace where that configuration triggers the deprecated Maven Enforcer Plugin API warning; done means the configuration no longer aborts the build or emits that warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.