cstamas commented on code in PR #13582:
URL: https://github.com/apache/maven/pull/13582#discussion_r4311378977


##########
maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java:
##########
@@ -132,24 +127,8 @@ public Map<String, Lifecycle> getPhaseToLifecycleMap() {
     public List<Lifecycle> getLifeCycles() {
         // ensure canonical order of standard lifecycles
 
-        Map<String, Lifecycle> lifecycles = new LinkedHashMap<>();
-
-        // filter by visibility (plexus vs sisu diff; "realms" are plexus 
thing)
-        // in some tests container is not injected
-        if (this.plexusContainer != null) {
-            for (String name : this.lifecycles.keySet()) {
-                if (!isEnabled(name)) {
-                    continue;
-                }
-                try {
-                    lifecycles.put(name, 
plexusContainer.lookup(Lifecycle.class, name));
-                } catch (ComponentLookupException e) {
-                    // skip it
-                }
-            }
-        } else {
-            lifecycles.putAll(this.lifecycles);
-        }
+        // take "snapshot": will filter by visibility
+        Map<String, Lifecycle> lifecycles = new 
LinkedHashMap<>(this.lifecycles);
 
         LinkedHashSet<String> lifecycleNames = new 
LinkedHashSet<>(getStandardLifecycles());
         lifecycleNames.addAll(lifecycles.keySet());

Review Comment:
   Wrong: filtering does happens.
   Fixed: the enabled filtering of lifecycle, added UT to cover it too.



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