mfriedenhagen commented on code in PR #427:
URL: 
https://github.com/apache/maven-install-plugin/pull/427#discussion_r3731845587


##########
src/main/java/org/apache/maven/plugins/install/InstallMojo.java:
##########
@@ -120,6 +121,26 @@ private boolean hasState(Project project) {
         return pluginContext.containsKey(INSTALL_PROCESSED_MARKER);
     }
 
+    /**
+     * Returns the list of reactor projects that have this plugin configured, 
cached on first call.
+     * The list is invariant during a build and is stored in the current 
project's plugin
+     * context to avoid recomputing it on every module invocation (O(N) total 
instead of O(N²)).
+     */
+    @SuppressWarnings("unchecked")
+    private List<Project> getProjectsUsingPlugin() {
+        List<Project> allProjects = session.getProjects();
+        if (allProjects.isEmpty()) {
+            return List.of();
+        }
+        Map<String, Object> ctx = session.getPluginContext(allProjects.get(0));
+        List<Project> cached = (List<Project>) 
ctx.get(PROJECTS_USING_PLUGIN_KEY);
+        if (cached == null) {

Review Comment:
   Does this work properly when Maven processes modules in parallel? I do not 
see any locking.



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