gnodet commented on code in PR #445:
URL: 
https://github.com/apache/maven-install-plugin/pull/445#discussion_r3903097537


##########
src/main/java/org/apache/maven/plugins/install/InstallMojo.java:
##########
@@ -163,19 +177,55 @@ public void execute() {
         }
 
         List<Project> projectsUsingPlugin = getProjectsUsingPlugin();
-        if (allProjectsMarked(projectsUsingPlugin)) {
-            for (Project reactorProject : projectsUsingPlugin) {
-                State state = getState(reactorProject);
-                if (state == State.TO_BE_INSTALLED) {
-                    Map<String, Object> pluginContext = 
session.getPluginContext(reactorProject);
-                    ArtifactInstallerRequest request =
-                            (ArtifactInstallerRequest) 
pluginContext.get(ArtifactInstallerRequest.class.getName());
-                    installProject(request);
+        synchronized (DEFERRED_INSTALL_LOCK) {
+            if (allProjectsMarked(projectsUsingPlugin)) {
+                List<Project> installedProjects = new ArrayList<>();
+                for (Project reactorProject : projectsUsingPlugin) {
+                    State state = getState(reactorProject);
+                    if (state == State.TO_BE_INSTALLED) {
+                        Map<String, Object> pluginContext = 
session.getPluginContext(reactorProject);
+                        ArtifactInstallerRequest request =
+                                (ArtifactInstallerRequest) 
pluginContext.get(ArtifactInstallerRequest.class.getName());
+                        try {
+                            installProject(request);

Review Comment:
   Correct — 3.x collects all artifacts into a single `InstallRequest` and 
calls `repositorySystem.install()` only once, so:
   
   - **f005 (usingPlugin)**: 3.x already matches by plugin presence 
(`hasExecution` checks goals + phase ≠ none), not by execution-id — no fix 
needed
   - **f005 (partial-install inventory)**: the single atomic install means 
there is no per-project loop that could fail mid-way — no partial state to log
   - **f006 (DEFERRED_INSTALL_LOCK)**: even if two threads race into the 
deferred block, the second call just re-installs the same request — idempotent, 
no risk of mixed state
   
   No backport to 3.x planned for this PR.



-- 
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]

Reply via email to