Skip to content

Replace deprecated MavenProject.getDependencyArtifacts() with getArtifacts() narrowed to direct dependencies - #695

Open
Sahas2711 wants to merge 1 commit into
apache:masterfrom
Sahas2711:fix/issue-694-replace-deprecated-getDependencyArtifacts
Open

Sahas2711 wants to merge 1 commit into
apache:masterfrom
Sahas2711:fix/issue-694-replace-deprecated-getDependencyArtifacts

Conversation

@Sahas2711

Copy link
Copy Markdown

Summary

Replaces the Maven 3-deprecated MavenProject.getDependencyArtifacts() call in OverlayManager with getArtifacts() filtered to direct dependencies (two-element dependency trail).

Problem

Part of apache/maven#14157. OverlayManager.getAssociatedArtifact still calls MavenProject.getDependencyArtifacts(), deprecated since Maven 3.

Root Cause

Historical usage; the fallback path for non-war overlay artifacts was never migrated when the API was deprecated.

Solution

  • Use project.getArtifacts() and keep only direct dependencies (dependency trail of length 2, or null trail for environments that do not record trails so test stubs keep working).
  • Behavior and parameters unchanged: same overlays resolve, same exception when an overlay is not a project dependency.

Testing

  • mvn -DskipITs test — 104 tests, 0 failures, 0 errors (full unit suite including OverlayManagerTest and WarZipTest).

Scope

  • src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java

Checklist

  • Follows contribution guidelines.

  • Includes regression tests where applicable (existing suite covers the path).

  • No unrelated changes.

  • Formatting and static analysis checked.

  • Relevant tests executed.

  • No known breaking changes.

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004.

Part of #694

Copilot AI balanced review requested due to automatic review settings November 28, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants