gnodet opened a new pull request, #13256: URL: https://github.com/apache/maven/pull/13256
## Problem When `jar:jar` is run on a `pom`-packaged project, it sets `project.getArtifact().getFile()` to the produced JAR. Since a pom-packaged project shares the same artifact coordinates for both the POM artifact and its main artifact, a subsequent call to `install:install` (which calls `setPath(pomArtifact, pomPath)` then `getPath(pomArtifact)`) was returning the JAR file instead of the registered POM path — installing the JAR at the POM coordinates in the local repository. ## Root Cause In `DefaultArtifactManager.getPath()`, the project artifact loop (`project.getArtifact().getFile()`) ran **before** checking the explicitly-registered `paths` map. The `paths` map is populated by `setPath()`, which is called by `install:install` with the correct POM path — but that value was never reached because the project loop returned first. ## Fix Check the `paths` map **first** in `getPath()`. Any path explicitly registered via `setPath()` takes precedence over `project.getArtifact().getFile()`. ## Tests Unit test added: `DefaultArtifactManagerTest.setPathTakesPrecedenceOverProjectArtifactFile()` Integration test in maven-install-plugin: MINSTALL-315 (`minstall-315-pom-packaged-jar-jar`) Fixes MINSTALL-315. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
