001    package 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    
022    import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
023    import org.apache.maven.artifact.resolver.ArtifactResolutionException;
024    import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
025    import org.apache.maven.model.Plugin;
026    import org.apache.maven.model.ReportPlugin;
027    import org.apache.maven.plugin.version.PluginVersionNotFoundException;
028    import org.apache.maven.plugin.version.PluginVersionResolutionException;
029    
030    /**
031     * Signifies a failure to load a plugin. This is used to abstract the specific errors which may be
032     * encountered at lower levels, and provide a dependable interface to the plugin-loading framework.
033     *
034     * @author jdcasey
035     *
036     */
037    public class PluginLoaderException
038        extends Exception
039    {
040    
041        private String pluginKey;
042    
043        public PluginLoaderException( Plugin plugin, String message, ArtifactResolutionException cause )
044        {
045            super( message, cause );
046            pluginKey = plugin.getKey();
047        }
048    
049        public PluginLoaderException( Plugin plugin, String message, ArtifactNotFoundException cause )
050        {
051            super( message, cause );
052            pluginKey = plugin.getKey();
053        }
054    
055        public PluginLoaderException( Plugin plugin, String message, PluginNotFoundException cause )
056        {
057            super( message, cause );
058            pluginKey = plugin.getKey();
059        }
060    
061        public PluginLoaderException( Plugin plugin, String message, PluginVersionResolutionException cause )
062        {
063            super( message, cause );
064            pluginKey = plugin.getKey();
065        }
066    
067        public PluginLoaderException( Plugin plugin, String message, InvalidVersionSpecificationException cause )
068        {
069            super( message, cause );
070            pluginKey = plugin.getKey();
071        }
072    
073        public PluginLoaderException( Plugin plugin, String message, InvalidPluginException cause )
074        {
075            super( message, cause );
076            pluginKey = plugin.getKey();
077        }
078    
079        public PluginLoaderException( Plugin plugin, String message, PluginManagerException cause )
080        {
081            super( message, cause );
082            pluginKey = plugin.getKey();
083        }
084    
085        public PluginLoaderException( Plugin plugin, String message, PluginVersionNotFoundException cause )
086        {
087            super( message, cause );
088            pluginKey = plugin.getKey();
089        }
090    
091        public PluginLoaderException( Plugin plugin, String message )
092        {
093            super( message );
094            pluginKey = plugin.getKey();
095        }
096    
097        public PluginLoaderException( String message )
098        {
099            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    }