Added PluginException to aggregate the different plugin exceptions

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@425096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2006-07-24 15:52:30 +00:00
parent a8dc29a9dc
commit 7a4138fe43
7 changed files with 65 additions and 40 deletions

View File

@ -1,7 +1,7 @@
package org.apache.maven.lifecycle;
/*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@ -34,11 +35,11 @@
import org.apache.maven.model.ReportSet;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.PluginConfigurationException;
import org.apache.maven.plugin.PluginException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.plugin.PluginNotFoundException;
@ -46,8 +47,6 @@
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.lifecycle.Execution;
import org.apache.maven.plugin.lifecycle.Phase;
import org.apache.maven.plugin.version.PluginVersionNotFoundException;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.reporting.MavenReport;
@ -1256,7 +1255,7 @@ private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Sett
throw new LifecycleExecutionException(
"Internal error in the plugin manager getting plugin '" + plugin.getKey() + "': " + e.getMessage(), e );
}
catch ( PluginVersionResolutionException e )
catch ( PluginException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
@ -1264,19 +1263,7 @@ private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Sett
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( InvalidPluginException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( ArtifactNotFoundException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( ArtifactResolutionException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( PluginVersionNotFoundException e )
catch ( AbstractArtifactResolutionException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
@ -1296,7 +1283,7 @@ private PluginDescriptor verifyReportPlugin( ReportPlugin plugin, MavenProject p
throw new LifecycleExecutionException(
"Internal error in the plugin manager getting report '" + plugin.getKey() + "': " + e.getMessage(), e );
}
catch ( PluginVersionResolutionException e )
catch ( PluginException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
@ -1304,19 +1291,7 @@ private PluginDescriptor verifyReportPlugin( ReportPlugin plugin, MavenProject p
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( InvalidPluginException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( ArtifactNotFoundException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( ArtifactResolutionException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}
catch ( PluginVersionNotFoundException e )
catch ( AbstractArtifactResolutionException e )
{
throw new LifecycleExecutionException( e.getMessage(), e );
}

View File

@ -1,7 +1,7 @@
package org.apache.maven.plugin;
/*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
* @version $Id$
*/
public class InvalidPluginException
extends Exception
extends PluginException
{
public InvalidPluginException( String message, Exception e )
{

View File

@ -1,7 +1,7 @@
package org.apache.maven.plugin;
/*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@
* @version $Id$
*/
public class PluginConfigurationException
extends Exception
extends PluginException
{
private final PluginDescriptor pluginDescriptor;

View File

@ -0,0 +1,37 @@
package org.apache.maven.plugin;
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Marker exception to aggregate all kind of plugin exceptions.
*
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
public abstract class PluginException
extends Exception
{
public PluginException( String message )
{
super( message );
}
public PluginException( String message, Throwable t )
{
super( message, t );
}
}

View File

@ -17,6 +17,7 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@ -54,12 +55,20 @@ MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenS
Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project );
/**
* TODO should throw {@link PluginException} and {@link AbstractArtifactResolutionException}
* instead of all the subclasses
*/
PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
PluginVersionNotFoundException;
/**
* TODO should throw {@link PluginException} and {@link AbstractArtifactResolutionException}
* instead of all the subclasses
*/
PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,

View File

@ -1,7 +1,7 @@
package org.apache.maven.plugin.version;
/*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,10 @@
* limitations under the License.
*/
import org.apache.maven.plugin.PluginException;
public class PluginVersionNotFoundException
extends Exception
extends PluginException
{
private final String groupId;

View File

@ -1,7 +1,7 @@
package org.apache.maven.plugin.version;
/*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,10 @@
* limitations under the License.
*/
import org.apache.maven.plugin.PluginException;
public class PluginVersionResolutionException
extends Exception
extends PluginException
{
private final String groupId;