View Javadoc

1   package org.apache.maven.plugin;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
23  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
24  import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
25  import org.apache.maven.model.Plugin;
26  import org.apache.maven.model.ReportPlugin;
27  import org.apache.maven.plugin.version.PluginVersionNotFoundException;
28  import org.apache.maven.plugin.version.PluginVersionResolutionException;
29  
30  /**
31   * Signifies a failure to load a plugin. This is used to abstract the specific errors which may be
32   * encountered at lower levels, and provide a dependable interface to the plugin-loading framework.
33   *
34   * @author jdcasey
35   *
36   */
37  public class PluginLoaderException
38      extends Exception
39  {
40  
41      private String pluginKey;
42  
43      public PluginLoaderException( Plugin plugin, String message, ArtifactResolutionException cause )
44      {
45          super( message, cause );
46          pluginKey = plugin.getKey();
47      }
48  
49      public PluginLoaderException( Plugin plugin, String message, ArtifactNotFoundException cause )
50      {
51          super( message, cause );
52          pluginKey = plugin.getKey();
53      }
54  
55      public PluginLoaderException( Plugin plugin, String message, PluginNotFoundException cause )
56      {
57          super( message, cause );
58          pluginKey = plugin.getKey();
59      }
60  
61      public PluginLoaderException( Plugin plugin, String message, PluginVersionResolutionException cause )
62      {
63          super( message, cause );
64          pluginKey = plugin.getKey();
65      }
66  
67      public PluginLoaderException( Plugin plugin, String message, InvalidVersionSpecificationException cause )
68      {
69          super( message, cause );
70          pluginKey = plugin.getKey();
71      }
72  
73      public PluginLoaderException( Plugin plugin, String message, InvalidPluginException cause )
74      {
75          super( message, cause );
76          pluginKey = plugin.getKey();
77      }
78  
79      public PluginLoaderException( Plugin plugin, String message, PluginManagerException cause )
80      {
81          super( message, cause );
82          pluginKey = plugin.getKey();
83      }
84  
85      public PluginLoaderException( Plugin plugin, String message, PluginVersionNotFoundException cause )
86      {
87          super( message, cause );
88          pluginKey = plugin.getKey();
89      }
90  
91      public PluginLoaderException( Plugin plugin, String message )
92      {
93          super( message );
94          pluginKey = plugin.getKey();
95      }
96  
97      public PluginLoaderException( String message )
98      {
99          super( message );
100     }
101 
102     public PluginLoaderException( String message, Throwable cause )
103     {
104         super( message, cause );
105     }
106 
107     public PluginLoaderException( ReportPlugin plugin, String message, Throwable cause )
108     {
109         super( message, cause );
110         pluginKey = plugin.getKey();
111     }
112 
113     public PluginLoaderException( ReportPlugin plugin, String message )
114     {
115         super( message );
116         pluginKey = plugin.getKey();
117     }
118 
119     public String getPluginKey()
120     {
121         return pluginKey;
122     }
123 
124 }