View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin;
20  
21  import org.apache.maven.model.Plugin;
22  import org.apache.maven.plugin.descriptor.MojoDescriptor;
23  import org.codehaus.plexus.classworlds.realm.ClassRealm;
24  import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
25  import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
26  import org.codehaus.plexus.configuration.PlexusConfigurationException;
27  
28  /**
29   * Exception which occurs to indicate that the plugin cannot be initialized due
30   * to some deeper problem with Plexus. Context information includes the groupId,
31   * artifactId, and version for the plugin; at times, the goal name for which
32   * execution failed; a message detailing the problem; the ClassRealm used to
33   * look up the plugin; and the Plexus exception that caused this error.
34   *
35   * @author jdcasey
36   *
37   */
38  public class PluginContainerException extends PluginManagerException {
39  
40      private ClassRealm pluginRealm;
41  
42      public PluginContainerException(
43              MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, Throwable e) {
44          super(mojoDescriptor, message, e);
45  
46          this.pluginRealm = pluginRealm;
47      }
48  
49      public PluginContainerException(
50              MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, ComponentLookupException e) {
51          super(mojoDescriptor, message, e);
52  
53          this.pluginRealm = pluginRealm;
54      }
55  
56      public PluginContainerException(Plugin plugin, ClassRealm pluginRealm, String message, Throwable e) {
57          super(plugin, message, e);
58  
59          this.pluginRealm = pluginRealm;
60      }
61  
62      public PluginContainerException(
63              Plugin plugin, ClassRealm pluginRealm, String message, PlexusConfigurationException e) {
64          super(plugin, message, e);
65  
66          this.pluginRealm = pluginRealm;
67      }
68  
69      public PluginContainerException(
70              Plugin plugin, ClassRealm pluginRealm, String message, ComponentRepositoryException e) {
71          super(plugin, message, e);
72  
73          this.pluginRealm = pluginRealm;
74      }
75  
76      public ClassRealm getPluginRealm() {
77          return pluginRealm;
78      }
79  }