001package org.apache.maven.plugin;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.maven.model.Plugin;
023import org.apache.maven.plugin.descriptor.MojoDescriptor;
024import org.codehaus.plexus.classworlds.realm.ClassRealm;
025import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
026import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
027import org.codehaus.plexus.configuration.PlexusConfigurationException;
028
029/**
030 * Exception which occurs to indicate that the plugin cannot be initialized due
031 * to some deeper problem with Plexus. Context information includes the groupId,
032 * artifactId, and version for the plugin; at times, the goal name for which
033 * execution failed; a message detailing the problem; the ClassRealm used to
034 * lookup the plugin; and the Plexus exception that caused this error.
035 *
036 * @author jdcasey
037 *
038 */
039public class PluginContainerException
040    extends PluginManagerException
041{
042
043    private ClassRealm pluginRealm;
044
045    public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
046                                     Throwable e )
047    {
048        super( mojoDescriptor, message, e );
049
050        this.pluginRealm = pluginRealm;
051    }
052
053    public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
054                                     ComponentLookupException e )
055    {
056        super( mojoDescriptor, message, e );
057
058        this.pluginRealm = pluginRealm;
059    }
060
061    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, Throwable e )
062    {
063        super( plugin, message, e );
064
065        this.pluginRealm = pluginRealm;
066    }
067
068    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
069                                     PlexusConfigurationException e )
070    {
071        super( plugin, message, e );
072
073        this.pluginRealm = pluginRealm;
074    }
075
076    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
077                                     ComponentRepositoryException e )
078    {
079        super( plugin, message, e );
080
081        this.pluginRealm = pluginRealm;
082    }
083
084    public ClassRealm getPluginRealm()
085    {
086        return pluginRealm;
087    }
088}