You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MavenProject.getArtifacts() publishes a half-built set under concurrent access #13200
A second thread calling getArtifacts() during the loop receives the half-built set and any iteration over it throws ConcurrentModificationException while the first thread keeps adding. The MojoExecutor project and aggregator locks keep mojo executions apart, so in a plain build the two callers should not overlap; the trace in apache/maven-plugin-tools#852 (maven-plugin-plugin:descriptor on a parallel build, LinkedHashMap$LinkedHashIterator.nextNode under JavaAnnotationsMojoDescriptorExtractor.extendJavaProjectBuilder) shows that something does overlap. The trigger there is not identified; the publication itself is unsafe regardless.
Fill a local set and assign it once, so a concurrent reader sees either null handling or a complete set:
Set<Artifact> result = newLinkedHashSet<>(...);
for (...) { ... result.add(artifact); }
artifacts = result;
The same pattern exists in getArtifactMap() / getDependencyArtifacts() and is worth the same treatment.
Activity
Fix apache#13200: publish a complete set from MavenProject.getArtifacts
Fix #13200: publish a complete set from MavenProject.getArtifacts
Fix #13200: publish a complete set from MavenProject.getArtifacts