code: private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,
                                    ArtifactRepository localRepository )
          throws LifecycleExecutionException, PluginNotFoundException
      {
          Object pluginComponent = null;
  
          @SuppressWarnings( "unchecked" )
          List<Plugin> buildPlugins = project.getBuildPlugins();
          for ( Plugin plugin : buildPlugins )
          {
              if ( plugin.isExtensions() )
              {
                  verifyPlugin( plugin, project, settings, localRepository );
  
                  // TODO: if moved to the plugin manager we
                  // already have the descriptor from above
                  // and so do can lookup the container
                  // directly
                  try
                  {
                      pluginComponent = pluginManager.getPluginComponent( plugin, role, roleHint );
                      
                      if ( pluginComponent != null )
                      {
                          break;
                      }
                  }
                  catch ( ComponentLookupException e )
                  {
                      log.debug( "Unable to find the lifecycle component in the extension", e );
                  }
                  catch ( PluginManagerException e )
                  {
                      throw new LifecycleExecutionException( "Error getting extensions from the plugin '"
                          + plugin.getKey() + "': " + e.getMessage(), e );
                  }
              }
          }
          return pluginComponent;
      }
docs: Find extension.
  
  @param project the project
  @param role the role
  @param roleHint the role hint
  @param settings the settings
  @param localRepository the local repository
  @return the object
  @throws LifecycleExecutionException the lifecycle execution exception
  @throws PluginNotFoundException the plugin not found exception