goutamadwant commented on code in PR #13041:
URL: https://github.com/apache/maven/pull/13041#discussion_r3946794308


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultLifecycleBindingsInjector.java:
##########
@@ -86,10 +84,19 @@ public Model injectLifecycleBindings(Model model, 
ModelBuilderRequest request, M
             Model lifecycleModel = Model.newBuilder()
                     
.build(Build.newBuilder().plugins(allPlugins.values()).build())
                     .build();
-            return merger.merge(model, lifecycleModel);
+            return new 
LifecycleBindingsMerger(getPhaseToLifecycleMap()).merge(model, lifecycleModel);
         }
     }
 
+    private Map<String, String> getPhaseToLifecycleMap() {
+        Map<String, String> phaseToLifecycle = new HashMap<>();
+        lifecycleRegistry.stream().forEach(lifecycle -> {
+            lifecycleRegistry.computePhases(lifecycle).forEach(phase -> 
phaseToLifecycle.put(phase, lifecycle.id()));
+            lifecycle.aliases().forEach(alias -> 
phaseToLifecycle.put(alias.v3Phase(), lifecycle.id()));

Review Comment:
   The legacy path already includes aliases through DefaultLifecycles' 
LifecycleRegistry adapter. Added a comment and an alias regression test for 
each model implementation.



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