gnodet opened a new pull request, #457: URL: https://github.com/apache/maven-install-plugin/pull/457
## Problem When `jar:jar` is invoked on a `pom`-packaged project, `maven-jar-plugin 3.x` calls `project.getArtifact().setFile(jarFile)`, setting the main artifact's file to the produced JAR. In `InstallMojo.processProject()`, for a `pom`-packaged project, `pomArtifact` and `projectArtifact` have the same coordinates. The existing code replaced `pomArtifact` with `projectArtifact` when `projectArtifact` had a file — which was the JAR set by `jar:jar`. This caused `install:install` to install the JAR under the `.pom` extension in the local repository. ## Root cause In 3.1.1, this was guarded by `if (!"pom".equals(project.getPackaging()))`. That guard was removed in 3.1.2 (MINSTALL-192) with the intent of "handling it centrally" — but the central handling is the buggy substitution itself. ## Fix Remove the `pomArtifact = projectArtifact` substitution. `pomArtifact` is constructed via `new ProjectArtifact(project)`, which wraps `project.getFile()` — always the POM file, regardless of what other plugins set on `project.getArtifact().getFile()`. This is the correct artifact to install. ## Test Added IT `minstall-315`: runs `jar:jar install:install` on a `pom`-packaged project and verifies that the installed artifact is valid XML (a POM), not a ZIP (a 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]
