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, Throwable e )
046    {
047        super( mojoDescriptor, message, e );
048
049        this.pluginRealm = pluginRealm;
050    }
051
052    public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
053                                     ComponentLookupException e )
054    {
055        super( mojoDescriptor, message, e );
056
057        this.pluginRealm = pluginRealm;
058    }
059
060    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, Throwable e )
061    {
062        super( plugin, message, e );
063
064        this.pluginRealm = pluginRealm;
065    }
066
067    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
068                                     PlexusConfigurationException e )
069    {
070        super( plugin, message, e );
071
072        this.pluginRealm = pluginRealm;
073    }
074
075    public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
076                                     ComponentRepositoryException e )
077    {
078        super( plugin, message, e );
079
080        this.pluginRealm = pluginRealm;
081    }
082
083    public ClassRealm getPluginRealm()
084    {
085        return pluginRealm;
086    }
087}