laeubi commented on a change in pull request #667:
URL: https://github.com/apache/maven/pull/667#discussion_r800201523



##########
File path: maven-core/src/main/java/org/apache/maven/DefaultMaven.java
##########
@@ -463,51 +484,68 @@ private void validateLocalRepository( 
MavenExecutionRequest request )
         }
     }
 
-    private Collection<AbstractMavenLifecycleParticipant> 
getLifecycleParticipants( Collection<MavenProject> projects )
+    private <T> Collection<T> getExtensionComponents( Collection<MavenProject> 
projects, Class<T> role )
     {
-        Collection<AbstractMavenLifecycleParticipant> lifecycleListeners = new 
LinkedHashSet<>();
+        Collection<T> foundComponents = new LinkedHashSet<>();
 
         ClassLoader originalClassLoader = 
Thread.currentThread().getContextClassLoader();
         try
         {
             try
             {
-                lifecycleListeners.addAll( container.lookupList( 
AbstractMavenLifecycleParticipant.class ) );
+                foundComponents.addAll( container.lookupList( role ) );
             }
             catch ( ComponentLookupException e )
             {
                 // this is just silly, lookupList should return an empty list!
-                logger.warn( "Failed to lookup lifecycle participants: " + 
e.getMessage() );
+                logger.warn( "Failed to lookup " + role + ": " + 
e.getMessage() );
             }
 
-            Collection<ClassLoader> scannedRealms = new HashSet<>();
+            foundComponents.addAll( getProjectScopedExtensionComponents( 
projects, role ) );
+        }
+        finally
+        {
+            Thread.currentThread().setContextClassLoader( originalClassLoader 
);

Review comment:
       I think this is obsolete because its done in the method call already, 
I'll adjust this.




-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to