Skip to content

Resolve classified POM artifacts from the reactor in Maven 3.x - #12659

Open
wilx wants to merge 1 commit into
apache:maven-3.10.xfrom
wilx:mdep-590-classified-pom-it-3.x
Open

Resolve classified POM artifacts from the reactor in Maven 3.x#12659
wilx wants to merge 1 commit into
apache:maven-3.10.xfrom
wilx:mdep-590-classified-pom-it-3.x

Conversation

@wilx

@wilx wilx commented Aug 2, 2026

Copy link
Copy Markdown

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Description

Maven 3's ReactorReader returns the reactor project's build POM for every artifact request whose extension is pom, before considering the classifier. Consequently, resolving an attached classified POM from the reactor returns pom.xml instead of the attached artifact.

This change limits the build-POM shortcut to unclassified POM requests. Classified POMs proceed through the existing artifact-matching path, which selects the attached artifact by extension and classifier. A focused unit test reproduces the incorrect path before the fix and verifies the attached POM afterward.

This is the Maven 3.10.x counterpart to #12658.

Fixes apache/maven-dependency-plugin#1024

Tests

  • Regression test before the fix: expected custom.pom, but ReactorReader returned pom.xml.
  • Full root mvn verify: all 16 modules passed with RAT, Checkstyle, Spotless, Animal Sniffer, and unit tests enabled.
  • maven-core: 367 tests, 0 failures, 0 errors, 1 skipped.
  • Complete unfiltered Maven 3.10.x Core IT suite with run-its,embedded: all 78 modules passed; 867 tests, 0 failures, 0 errors, 39 skipped.

ReactorReader treated every POM request as the project build POM, ignoring the classifier. Let classified POMs proceed through attached-artifact matching and cover the behavior with a focused regression test.
@wilx
wilx marked this pull request as ready for review August 2, 2026 16:52

@gnodet gnodet 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.

Clean backport of the 4.x ReactorReader fix (PR #12658) to 3.x. The one-line production change is identical in logic, correctly adapted for the 3.x find() method signature.

The null-or-empty classifier guard is appropriately defensive, and the new unit test properly verifies the fix by exercising the full resolution path through findMatchingArtifact.

Note: the 4.x PR includes integration test resources under its/core-it-suite, but their absence here is expected since Maven 3.x core integration tests live in a separate repository (apache/maven-integration-testing). The unit test provides equivalent regression coverage.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@slachiewicz slachiewicz added the bug Something isn't working label Aug 3, 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.

3 participants