slawekjaranowski commented on code in PR #11916:
URL: https://github.com/apache/maven/pull/11916#discussion_r3060316909


##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java:
##########
@@ -79,7 +88,22 @@ public Set<Plugin> 
getPluginsBoundByDefaultToAllLifecycles(String packaging) {
                     + Thread.currentThread().getContextClassLoader());
         }
 
-        LifecycleMapping lifecycleMappingForPackaging = 
lifecycleMappings.get(packaging);
+        Map<String, LifecycleMapping> filtered = new HashMap<>();
+        // 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.lifecycleMappings.keySet()) {
+                try {
+                    filtered.put(name, 
plexusContainer.lookup(LifecycleMapping.class, name));
+                } catch (ComponentLookupException e) {
+                    // skip it
+                }

Review Comment:
   Can we use `hasComponent` instead of catch exception?



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