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.artifact.resolver.ArtifactNotFoundException;
22  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
23  import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
24  import org.apache.maven.model.Plugin;
25  import org.apache.maven.model.ReportPlugin;
26  import org.apache.maven.plugin.version.PluginVersionNotFoundException;
27  import org.apache.maven.plugin.version.PluginVersionResolutionException;
28  
29  /**
30   * Signifies a failure to load a plugin. This is used to abstract the specific errors which may be
31   * encountered at lower levels, and provide a dependable interface to the plugin-loading framework.
32   *
33   * @author jdcasey
34   *
35   */
36  public class PluginLoaderException extends Exception {
37  
38      private String pluginKey;
39  
40      public PluginLoaderException(Plugin plugin, String message, ArtifactResolutionException cause) {
41          super(message, cause);
42          pluginKey = plugin.getKey();
43      }
44  
45      public PluginLoaderException(Plugin plugin, String message, ArtifactNotFoundException cause) {
46          super(message, cause);
47          pluginKey = plugin.getKey();
48      }
49  
50      public PluginLoaderException(Plugin plugin, String message, PluginNotFoundException cause) {
51          super(message, cause);
52          pluginKey = plugin.getKey();
53      }
54  
55      public PluginLoaderException(Plugin plugin, String message, PluginVersionResolutionException cause) {
56          super(message, cause);
57          pluginKey = plugin.getKey();
58      }
59  
60      public PluginLoaderException(Plugin plugin, String message, InvalidVersionSpecificationException cause) {
61          super(message, cause);
62          pluginKey = plugin.getKey();
63      }
64  
65      public PluginLoaderException(Plugin plugin, String message, InvalidPluginException cause) {
66          super(message, cause);
67          pluginKey = plugin.getKey();
68      }
69  
70      public PluginLoaderException(Plugin plugin, String message, PluginManagerException cause) {
71          super(message, cause);
72          pluginKey = plugin.getKey();
73      }
74  
75      public PluginLoaderException(Plugin plugin, String message, PluginVersionNotFoundException cause) {
76          super(message, cause);
77          pluginKey = plugin.getKey();
78      }
79  
80      public PluginLoaderException(Plugin plugin, String message) {
81          super(message);
82          pluginKey = plugin.getKey();
83      }
84  
85      public PluginLoaderException(String message) {
86          super(message);
87      }
88  
89      public PluginLoaderException(String message, Throwable cause) {
90          super(message, cause);
91      }
92  
93      public PluginLoaderException(ReportPlugin plugin, String message, Throwable cause) {
94          super(message, cause);
95          pluginKey = plugin.getKey();
96      }
97  
98      public PluginLoaderException(ReportPlugin plugin, String message) {
99          super(message);
100         pluginKey = plugin.getKey();
101     }
102 
103     public String getPluginKey() {
104         return pluginKey;
105     }
106 }