kalayciburak opened a new pull request, #13201: URL: https://github.com/apache/maven/pull/13201
Fixes #13200 ### Context `MavenProject.getArtifacts()` assigned the field before filling the `LinkedHashSet`. A concurrent caller could observe an empty or half-built set (and iteration could throw `ConcurrentModificationException`). Fill a local set and assign it once, as described in the issue. On current `master`, `getArtifactMap()` already assigns a completed map from `ArtifactUtils`, and `getDependencyArtifacts()` is not lazily populated. ### Checklist - [x] [Review Contribution Guidelines](https://github.com/jreleaser/.github/blob/main/CONTRIBUTING.adoc). - [x] Make sure all contributed code can be distributed under the terms of the Apache License 2.0. - [ ] Update documentation when applicable. ### Test Plan Executed with `JAVA_HOME` 17 and Maven 3.9.11: - RED: `MavenProjectGetArtifactsTest` failed with `expected: <200> but was: <0>` (half-built set published). - GREEN: `mvn -pl impl/maven-core -am test -Dtest=MavenProjectGetArtifactsTest,MavenProjectTest -Dsurefire.failIfNoSpecifiedTests=false` - `MavenProjectGetArtifactsTest` 1/0 - `MavenProjectTest` 13/0 -- 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]
