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   *
34   */
35  public class PluginLoaderException extends Exception {
36  
37      private String pluginKey;
38  
39      public PluginLoaderException(Plugin plugin, String message, ArtifactResolutionException cause) {
40          super(message, cause);
41          pluginKey = plugin.getKey();
42      }
43  
44      public PluginLoaderException(Plugin plugin, String message, ArtifactNotFoundException cause) {
45          super(message, cause);
46          pluginKey = plugin.getKey();
47      }
48  
49      public PluginLoaderException(Plugin plugin, String message, PluginNotFoundException cause) {
50          super(message, cause);
51          pluginKey = plugin.getKey();
52      }
53  
54      public PluginLoaderException(Plugin plugin, String message, PluginVersionResolutionException cause) {
55          super(message, cause);
56          pluginKey = plugin.getKey();
57      }
58  
59      public PluginLoaderException(Plugin plugin, String message, InvalidVersionSpecificationException cause) {
60          super(message, cause);
61          pluginKey = plugin.getKey();
62      }
63  
64      public PluginLoaderException(Plugin plugin, String message, InvalidPluginException cause) {
65          super(message, cause);
66          pluginKey = plugin.getKey();
67      }
68  
69      public PluginLoaderException(Plugin plugin, String message, PluginManagerException cause) {
70          super(message, cause);
71          pluginKey = plugin.getKey();
72      }
73  
74      public PluginLoaderException(Plugin plugin, String message, PluginVersionNotFoundException cause) {
75          super(message, cause);
76          pluginKey = plugin.getKey();
77      }
78  
79      public PluginLoaderException(Plugin plugin, String message) {
80          super(message);
81          pluginKey = plugin.getKey();
82      }
83  
84      public PluginLoaderException(String message) {
85          super(message);
86      }
87  
88      public PluginLoaderException(String message, Throwable cause) {
89          super(message, cause);
90      }
91  
92      public PluginLoaderException(ReportPlugin plugin, String message, Throwable cause) {
93          super(message, cause);
94          pluginKey = plugin.getKey();
95      }
96  
97      public PluginLoaderException(ReportPlugin plugin, String message) {
98          super(message);
99          pluginKey = plugin.getKey();
100     }
101 
102     public String getPluginKey() {
103         return pluginKey;
104     }
105 }