arturobernalg commented on PR #13591: URL: https://github.com/apache/maven/pull/13591#issuecomment-6281716199
Thanks for the detailed analysis, this is exactly right and matches what you described: only `setArtifactFilter` runs unconditionally, `setResolvedArtifacts` is already gated by `isResolutionRequiredForCurrentProject()`. Implemented as you suggested, in two parts: 1. `MojoExecutor#ensureDependenciesAreResolved` (the shared base class) now only replaces a project's artifact filter when the mojo actually declared a scope to resolve or collect. A mojo with no such declaration leaves the filter untouched, since it has no business reading it in the first place. 2. The concurrent `MojoExecutor#getProjectLock` now takes the per-project lock only for a mojo that would write to the shared `MavenProject` this way (dependency requirement) or that is an aggregator (which writes every project's filter, not just the current one, so it still needs it). Everything else, including Maven 4 `@Resolution` mojos, skips the lock entirely and runs fully in parallel, same project or not. I agree this doesn't fully close the race for two legacy mojos with different scopes on the same project, as you noted, but it's a strict improvement over serializing every execution. `MojoExecutorTest` now covers three cases instead of one: two dependency-requiring (or aggregator) executions on the same project still don't overlap, two no-requirement executions on the same project now run in parallel, and two dependency-requiring executions on different projects run in parallel. `mvn -pl impl/maven-core test`: 764 tests, 0 failures. `spotless:check` clean. -- 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]
