private Object findExtension()

in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/RequirePluginVersions.java [742:771]


    private Object findExtension(
            MavenProject project, String role, String roleHint, Settings settings, ArtifactRepository localRepository)
            throws LifecycleExecutionException, PluginNotFoundException {
        Object pluginComponent = null;

        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) {
                    getLog().debug("Unable to find the lifecycle component in the extension " + e.getMessage());
                } catch (PluginManagerException e) {
                    throw new LifecycleExecutionException(
                            "Error getting extensions from the plugin '" + plugin.getKey() + "': " + e.getMessage(), e);
                }
            }
        }
        return pluginComponent;
    }