Search in sources :

Example 1 with PluginManager

use of org.apache.maven.plugin.PluginManager in project intellij-community by JetBrains.

the class MavenEmbedder method findArtifactTypeHandlers.

@SuppressWarnings({ "unchecked" })
private Map findArtifactTypeHandlers(MavenProject project) {
    // end copied from DefaultLifecycleExecutor.findExtensions
    Map result = new HashMap();
    for (Object each : project.getBuildPlugins()) {
        Plugin eachPlugin = (Plugin) each;
        if (eachPlugin.isExtensions()) {
            try {
                PluginManager pluginManager = getComponent(PluginManager.class);
                pluginManager.verifyPlugin(eachPlugin, project, mySettings, myLocalRepository);
                result.putAll(pluginManager.getPluginComponents(eachPlugin, ArtifactHandler.ROLE));
            } catch (Exception e) {
                MavenEmbedderLog.LOG.info(e);
                continue;
            }
            for (Object o : result.values()) {
                ArtifactHandler handler = (ArtifactHandler) o;
                if (project.getPackaging().equals(handler.getPackaging())) {
                    project.getArtifact().setArtifactHandler(handler);
                }
            }
        }
    }
    return result;
}
Also used : PluginManager(org.apache.maven.plugin.PluginManager) ArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler) PlexusContainerException(org.codehaus.plexus.PlexusContainerException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) FileNotFoundException(java.io.FileNotFoundException) ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) SecDispatcherException(org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException) IOException(java.io.IOException) Plugin(org.apache.maven.model.Plugin)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)1 Plugin (org.apache.maven.model.Plugin)1 PluginManager (org.apache.maven.plugin.PluginManager)1 ModelInterpolationException (org.apache.maven.project.interpolation.ModelInterpolationException)1 PlexusContainerException (org.codehaus.plexus.PlexusContainerException)1 ComponentLookupException (org.codehaus.plexus.component.repository.exception.ComponentLookupException)1 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)1 SecDispatcherException (org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException)1