From 83720e04ca146a15b0fdfaa456d2a7b0d94411bc Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Wed, 4 Mar 2009 20:53:37 +0000 Subject: [PATCH] o use the remote repos processed by the request git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750152 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/DefaultPluginManager.java | 17 ++++------------- .../plugin/DefaultPluginManagerSupport.java | 19 +++++-------------- .../project/DefaultMavenProjectBuilder.java | 8 +++++--- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index c9bfade9d7..95e91b34e7 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -98,7 +98,6 @@ import org.codehaus.plexus.component.repository.exception.ComponentRepositoryExc import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.PlexusConfigurationException; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; -import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; @@ -170,23 +169,15 @@ public class DefaultPluginManager // // ---------------------------------------------------------------------- - public Plugin getPluginDefinitionForPrefix( String prefix, - MavenSession session, - MavenProject project ) + public Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project ) { // TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other // use for the mapping manager in here - return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), - project.getRemoteArtifactRepositories(), - session.getLocalRepository() ); + return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() ); } - public PluginDescriptor verifyPlugin( Plugin plugin, - MavenProject project, - MavenSession session ) - throws ArtifactResolutionException, PluginVersionResolutionException, - ArtifactNotFoundException, InvalidPluginException, - PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException + public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, MavenSession session ) + throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, InvalidPluginException, PluginManagerException, PluginNotFoundException, PluginVersionNotFoundException { String pluginVersion = plugin.getVersion(); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManagerSupport.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManagerSupport.java index fa812f9225..1028927aae 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManagerSupport.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManagerSupport.java @@ -78,11 +78,8 @@ public class DefaultPluginManagerSupport private Context containerContext; - public Artifact resolvePluginArtifact( Plugin plugin, - MavenProject project, - MavenSession session ) - throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException, - ArtifactResolutionException, ArtifactNotFoundException + public Artifact resolvePluginArtifact( Plugin plugin, MavenProject project, MavenSession session ) + throws PluginManagerException, InvalidPluginException, PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException { ArtifactRepository localRepository = session.getLocalRepository(); @@ -102,12 +99,9 @@ public class DefaultPluginManagerSupport if(pluginProject == null) { - pluginProject = buildPluginProject( plugin, - localRepository, - remoteRepositories ); + pluginProject = buildPluginProject( plugin, localRepository, remoteRepositories ); } - checkRequiredMavenVersion( plugin, pluginProject, localRepository, remoteRepositories ); checkPluginDependencySpec( plugin, pluginProject ); @@ -116,8 +110,7 @@ public class DefaultPluginManagerSupport pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact ); - ArtifactResolutionRequest request = - new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories ); + ArtifactResolutionRequest request = new ArtifactResolutionRequest( pluginArtifact, localRepository, remoteRepositories ); ArtifactResolutionResult result = repositorySystem.resolve( request ); resolutionErrorHandler.throwErrors( request, result ); @@ -130,9 +123,7 @@ public class DefaultPluginManagerSupport Artifact artifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() ); try { - return mavenProjectBuilder.buildFromRepository( artifact, - remoteRepositories, - localRepository ); + return mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository ); } catch ( ProjectBuildingException e ) { diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index d5fcdc083e..19bc014b02 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -208,7 +208,7 @@ public class DefaultMavenProjectBuilder return buildFromRepository( artifact, remoteArtifactRepositories, localRepository ); } - public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository ) + public MavenProject buildFromRepository( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws ProjectBuildingException { MavenProject project = hm.get( artifact.getId() ); @@ -218,7 +218,7 @@ public class DefaultMavenProjectBuilder return project; } - List artifactRepositories = new ArrayList( remoteArtifactRepositories ); + List artifactRepositories = new ArrayList( remoteRepositories ); try { artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( getSuperModel().getRepositories() ) ); @@ -246,7 +246,9 @@ public class DefaultMavenProjectBuilder throw new ProjectBuildingException( artifact.getId(), "Error with repository specified in project.", e ); } - ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ); + ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration() + .setLocalRepository( localRepository ) + .setRemoteRepositories( remoteRepositories ); project = readModelFromLocalPath( "unknown", artifact.getFile(), config.getLocalRepository(), artifactRepositories, config ); project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile() );