Resolve classified POM artifacts from the reactor in Maven 3.x - #12659
Resolve classified POM artifacts from the reactor in Maven 3.x#12659wilx wants to merge 1 commit into
Conversation
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.
gnodet
left a comment
There was a problem hiding this comment.
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
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
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
ReactorReaderreturns the reactor project's build POM for every artifact request whose extension ispom, before considering the classifier. Consequently, resolving an attached classified POM from the reactor returnspom.xmlinstead 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
custom.pom, butReactorReaderreturnedpom.xml.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.run-its,embedded: all 78 modules passed; 867 tests, 0 failures, 0 errors, 39 skipped.