arturobernalg opened a new pull request, #13635: URL: https://github.com/apache/maven/pull/13635
Backport of #13577 (fix #10291), already backported to maven-4.0.x (#13578) and maven-3.10.x (#13579) but missing on maven-3.9.x, which has the same ExecutionEventLogger counter logic. When an aggregator goal on the command line builds the first project again after the reactor finished (for instance "mvn package artifact:describe"), the project progress counter kept incrementing past the total project count, printing a confusing "[4/3]" instead of repeating "[1/3]". Remember the progress number already assigned to each project and reuse it instead of handing out a new one every time projectStarted fires for the same project. Fixes #10291 ### What Backports the fix for #10291 to maven-3.9.x. Same root cause as on master/4.0.x/3.10.x: `ExecutionEventLogger` hands out a fresh `[i/n]` progress number on every `projectStarted` event, so a project rebuilt by an aggregator goal (e.g. after `artifact:describe`-style post-reactor execution) gets a number past `n`. ### How - Same fix as #13578/#13579: a `Map<MavenProject, Integer>` remembers the number already assigned to a project and reuses it instead of incrementing past the total. - `maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java` on maven-3.9.x has the identical `currentVisitedProjectCount`/`totalProjects` structure as 3.10.x before that backport, so this is a direct, mechanical port of the same change. - The regression test from #13579 doesn't carry over verbatim because 3.9.x's `ExecutionEventLoggerTest` doesn't yet have the `project()`/`projectStarted()` mock helpers or a multi-module progress test at all, so I added both inline, matching this file's existing style. ### Tests - Reproduced first: ran the new test against the unfixed 3.9.x code (temporarily reverted via `git stash`) — fails as expected, with Mockito reporting the `[1/3]` log line for the re-built first project was never produced. - With the fix: `mvn -pl maven-embedder test`: 31 tests, 0 failures (4 in `ExecutionEventLoggerTest`, including the new one). - `checkstyle:check`: 0 violations. Note: I see maven-3.9.x is approaching EOL and backports there are meant to go through maintainer agreement first — opening this since it's the same already-accepted fix as #13579, just mechanically ported, but happy to close/hold if it's not wanted on this branch. --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [x] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- 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]
