o Specialized exception

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@827020 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-10-20 09:50:35 +00:00
parent 1dac10a618
commit 6e6f881bc8
4 changed files with 16 additions and 12 deletions

View File

@ -24,10 +24,10 @@ import java.util.List;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Model;
import org.apache.maven.model.building.AbstractModelBuildingListener;
import org.apache.maven.model.building.ModelBuildingEvent;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
/**
@ -116,7 +116,7 @@ class DefaultModelBuildingListener
project.setClassRealm( record.realm );
project.setExtensionArtifactFilter( record.extensionArtifactFilter );
}
catch ( ArtifactResolutionException e )
catch ( PluginResolutionException e )
{
event.getProblems().addError( "Unresolveable build extensions: " + e.getMessage(), e );
}

View File

@ -50,6 +50,7 @@ import org.apache.maven.model.Plugin;
import org.apache.maven.model.Repository;
import org.apache.maven.plugin.ExtensionRealmCache;
import org.apache.maven.plugin.PluginArtifactsCache;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.version.DefaultPluginVersionRequest;
import org.apache.maven.plugin.version.PluginVersionRequest;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
@ -135,7 +136,7 @@ public class DefaultProjectBuildingHelper
public synchronized ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
RepositoryRequest repositoryRequest )
throws ArtifactResolutionException, PluginVersionResolutionException
throws PluginResolutionException, PluginVersionResolutionException
{
ClassRealm projectRealm = null;
@ -381,7 +382,7 @@ public class DefaultProjectBuildingHelper
}
private List<Artifact> resolveExtensionArtifacts( Plugin extensionPlugin, RepositoryRequest repositoryRequest )
throws ArtifactResolutionException
throws PluginResolutionException
{
Artifact extensionArtifact = repositorySystem.createPluginArtifact( extensionPlugin );
@ -405,7 +406,14 @@ public class DefaultProjectBuildingHelper
ArtifactResolutionResult result = repositorySystem.resolve( request );
resolutionErrorHandler.throwErrors( request, result );
try
{
resolutionErrorHandler.throwErrors( request, result );
}
catch ( ArtifactResolutionException e )
{
throw new PluginResolutionException( extensionPlugin, e );
}
List<Artifact> extensionArtifacts = new ArrayList<Artifact>( result.getArtifacts() );

View File

@ -24,9 +24,9 @@ import java.util.List;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Model;
import org.apache.maven.model.Repository;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
/**
@ -62,10 +62,10 @@ public interface ProjectBuildingHelper
* @param model The model to create the project realm for, must not be {@code null}
* @param repositoryRequest The repository request to use for artifact resolution, must not be {@code null}.
* @return The record with the project realm and extension artifact filter, never {@code null}.
* @throws ArtifactResolutionException If any build extension could not be resolved.
* @throws PluginResolutionException If any build extension could not be resolved.
*/
ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
RepositoryRequest repositoryRequest )
throws ArtifactResolutionException, PluginVersionResolutionException;
throws PluginResolutionException, PluginVersionResolutionException;
}

View File

@ -22,10 +22,8 @@ package org.apache.maven.project;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Model;
import org.apache.maven.model.Repository;
import org.codehaus.plexus.component.annotations.Component;
@ -43,7 +41,6 @@ public class EmptyProjectBuildingHelper
public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
List<ArtifactRepository> externalRepositories,
ProjectBuildingRequest request )
throws InvalidRepositoryException
{
if ( externalRepositories != null )
{
@ -57,7 +54,6 @@ public class EmptyProjectBuildingHelper
public ProjectRealmCache.CacheRecord createProjectRealm( MavenProject proejct, Model model,
RepositoryRequest repositoryRequest )
throws ArtifactResolutionException
{
return new ProjectRealmCache.CacheRecord( null, null );
}