Skip to content

fix: avoid misleading legacy warning for unknown rules - #1037

Open
efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/issue-1023-unknown-rule-warning
Open

efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/issue-1023-unknown-rule-warning

Conversation

@efegokdemir

Copy link
Copy Markdown

Summary

Fix the misleading deprecated-API warning emitted when an unknown Enforcer rule is configured. The warning is now emitted only after the legacy rule class has been loaded successfully.

Fixes #1023

Changes

  • Instantiate the legacy rule before logging the compatibility warning.
  • Add a regression assertion that unknown rules do not emit the legacy warning.

Testing

  • mvn -pl maven-enforcer-plugin -am -Dtest=EnforcerRuleManagerTest -Dsurefire.failIfNoSpecifiedTests=false -Dspotless.apply.skip=true -Dspotless.check.skip=true test — PASS (10 tests)
  • git diff --check — PASS

The repository's Spotless formatter is not compatible with the available JDK 27 runtime (NoSuchFieldError); the focused test command therefore skipped Spotless only. Checkstyle and RAT completed successfully during the test build.

AI assistance was used during investigation and implementation. The submitted changes were reviewed for correctness and are limited to this issue.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
@slawekjaranowski slawekjaranowski added the bug Something isn't working label Sep 24, 2026
@slawekjaranowski slawekjaranowski self-assigned this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants