gnodet-bot commented on code in PR #13559:
URL: https://github.com/apache/maven/pull/13559#discussion_r4495675605


##########
impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanCreatorTest.java:
##########
@@ -466,4 +467,159 @@ protected void mojo(Consumer<String> writer, 
MojoExecution mojoExecution) {}
                     pred -> assertTrue(plan.step(pred.project, 
pred.name).isPresent(), "Phase not present: " + pred));
         });
     }
+
+    /**
+     * Verifies that when the requested phase is before "compile" (e.g. 
"initialize"),
+     * the new skip-clearing logic forces the reactor plugin project and all 
its
+     * predecessors to reach READY so that the plugin is available when needed.
+     */
+    @Test
+    void testReactorPluginPreCompilePhase() {
+        MavenProject p1 = new MavenProject();
+        p1.setGroupId("g");
+        p1.setArtifactId("p1");
+        p1.setVersion("1.0");
+        p1.setCollectedProjects(List.of());
+        Plugin plugin = new Plugin();
+        plugin.setGroupId("g");
+        plugin.setArtifactId("p2");
+        plugin.setVersion("1.0");
+        p1.getBuild().addPlugin(plugin);
+
+        MavenProject p2 = new MavenProject();
+        p2.setGroupId("g");
+        p2.setArtifactId("p2");
+        p2.setVersion("1.0");
+        p2.setCollectedProjects(List.of());
+
+        Map<MavenProject, List<MavenProject>> projects = new HashMap<>();
+        projects.put(p1, Collections.emptyList());
+        projects.put(p2, Collections.singletonList(p1));
+

Review Comment:
   🔧 **Nit:** The project ordering is inverted. `projects.put(p2, 
singletonList(p1))` makes the plugin (p2) list the consumer (p1) as its 
upstream dependency, which is backwards. Since p2 has no declared Maven 
dependencies on p1, `filterByScope` returns empty and no spurious cross-project 
edges are created — so the test passes correctly. But it's misleading compared 
to the second test which correctly has `projects.put(p2, singletonList(p3))` 
(plugin depends on library).
   
   ```suggestion
           Map<MavenProject, List<MavenProject>> projects = new HashMap<>();
           projects.put(p2, Collections.emptyList());
           projects.put(p1, Collections.singletonList(p2));
   ```



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