elharo opened a new pull request, #284: URL: https://github.com/apache/maven-remote-resources-plugin/pull/284
Fixes https://github.com/apache/maven-remote-resources-plugin/issues/268 ### Problem `getProjects()` called `artifact.setVersion(artifact.getBaseVersion())` on the artifact instances obtained from `getAllDependencies()`. For the `process` mojo, `getAllDependencies()` returns `project.getArtifacts()` directly, so this mutated the live, shared `Artifact` objects — stripping timestamped snapshot versions down to their base version as a side effect that later build steps observe. The mutation only happened when a template referenced `$projects`/`$projectsSortedByOrganization`. ### Fix Instead of mutating the shared instance, build a new `DefaultArtifact` from the artifact's base version (carrying over file, resolution state and the other coordinates) and use that only for the project model building. The original artifacts in `project.getArtifacts()` are left untouched. ### Test New unit test `testProjectsDoesNotMutateProjectArtifactVersions`: adds a snapshot artifact to the project, invokes `getProjects()`, and asserts the artifact's version is still `1.0-SNAPSHOT` (and that the same instance remains in `project.getArtifacts()`). Verified the test fails without the fix (`expected:<[1.0-SNAPSHOT]> but was:<[Test Version]>`) and passes with it. Full `mvn verify` (incl. spotless/checkstyle/RAT) passes. -- 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]
